<!DOCTYPE html><html class=split lang=en-US-x-hixie><script src=../link-fixup.js defer=""></script>
<!-- Mirrored from html.spec.whatwg.org/multipage/nav-history-apis.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 10 Sep 2025 08:35:52 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<meta charset=utf-8><meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name=viewport><title>HTML Standard</title><meta content=#3c790a name=theme-color><meta content="light dark" name=color-scheme><link rel=stylesheet href=../../resources.whatwg.org/standard-shared-with-dev.css crossorigin=""><link rel=stylesheet href=../../resources.whatwg.org/standard.css crossorigin=""><link rel=stylesheet href=../../resources.whatwg.org/spec.css crossorigin=""><link rel=icon href=https://resources.whatwg.org/logo.svg crossorigin=""><link rel=stylesheet href=../styles.css crossorigin=""><script>
   function toggleStatus(div) {
     div.parentNode.classList.toggle('wrapped');
   }
   function setLinkFragment(link) {
     link.hash = location.hash;
   }
  </script><body>
  
  <script defer="" crossorigin="" src=../html-dfn.js></script>
  
  <header id=head class="head with-buttons">
   <a href=https://whatwg.org/ class=logo><img width=100 alt=WHATWG crossorigin="" class=darkmode-aware src=https://resources.whatwg.org/logo.svg height=100></a>
   <hgroup><h1 class=allcaps>HTML</h1><p id=living-standard>Living Standard — Last Updated <span class=pubdate>10 September 2025</span></hgroup>
   
   

   
  </header>

  

  

  

  
  

  
  

  

  <nav><a href=browsers.html>← 7 Loading web pages</a> — <a href=index.html>Table of Contents</a> — <a href=document-sequences.html>7.3 Infrastructure for sequences of documents →</a></nav><ol class=toc><li id=toc-browsers><ol><li><a href=nav-history-apis.html#nav-traversal-apis><span class=secno>7.2</span> APIs related to navigation and
  session history</a><ol><li><a href=nav-history-apis.html#cross-origin-objects><span class=secno>7.2.1</span> Security infrastructure for <code>Window</code>,
  <code>WindowProxy</code>, and <code>Location</code> objects</a><ol><li><a href=nav-history-apis.html#integration-with-idl><span class=secno>7.2.1.1</span> Integration with IDL</a><li><a href=nav-history-apis.html#shared-internal-slot:-crossoriginpropertydescriptormap><span class=secno>7.2.1.2</span> Shared internal slot: [[CrossOriginPropertyDescriptorMap]]</a><li><a href=nav-history-apis.html#shared-abstract-operations><span class=secno>7.2.1.3</span> Shared abstract operations</a><ol><li><a href=nav-history-apis.html#crossoriginproperties-(-o-)><span class=secno>7.2.1.3.1</span> CrossOriginProperties ( <var>O</var> )</a><li><a href=nav-history-apis.html#crossoriginpropertyfallback-(-p-)><span class=secno>7.2.1.3.2</span> CrossOriginPropertyFallback ( <var>P</var> )</a><li><a href=nav-history-apis.html#isplatformobjectsameorigin-(-o-)><span class=secno>7.2.1.3.3</span> IsPlatformObjectSameOrigin ( <var>O</var> )</a><li><a href=nav-history-apis.html#crossorigingetownpropertyhelper-(-o,-p-)><span class=secno>7.2.1.3.4</span> CrossOriginGetOwnPropertyHelper ( <var>O</var>, <var>P</var> )</a><li><a href=nav-history-apis.html#crossoriginget-(-o,-p,-receiver-)><span class=secno>7.2.1.3.5</span> CrossOriginGet ( <var>O</var>, <var>P</var>, <var>Receiver</var> )</a><li><a href=nav-history-apis.html#crossoriginset-(-o,-p,-v,-receiver-)><span class=secno>7.2.1.3.6</span> CrossOriginSet ( <var>O</var>, <var>P</var>, <var>V</var>,
  <var>Receiver</var> )</a><li><a href=nav-history-apis.html#crossoriginownpropertykeys-(-o-)><span class=secno>7.2.1.3.7</span> CrossOriginOwnPropertyKeys ( <var>O</var> )</a></ol></ol><li><a href=nav-history-apis.html#the-window-object><span class=secno>7.2.2</span> The <code>Window</code> object</a><ol><li><a href=nav-history-apis.html#apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>7.2.2.1</span> Opening and closing windows</a><li><a href=nav-history-apis.html#accessing-other-browsing-contexts><span class=secno>7.2.2.2</span> Indexed access on the <code>Window</code> object</a><li><a href=nav-history-apis.html#named-access-on-the-window-object><span class=secno>7.2.2.3</span> Named access on the <code>Window</code> object</a><li><a href=nav-history-apis.html#navigating-nested-browsing-contexts-in-the-dom><span class=secno>7.2.2.4</span> Accessing related windows</a><li><a href=nav-history-apis.html#browser-interface-elements><span class=secno>7.2.2.5</span> Historical browser interface element APIs</a><li><a href=nav-history-apis.html#script-settings-for-window-objects><span class=secno>7.2.2.6</span> Script settings for <code>Window</code> objects</a></ol><li><a href=nav-history-apis.html#the-windowproxy-exotic-object><span class=secno>7.2.3</span> The <code>WindowProxy</code> exotic object</a><ol><li><a href=nav-history-apis.html#windowproxy-getprototypeof><span class=secno>7.2.3.1</span> [[GetPrototypeOf]] ( )</a><li><a href=nav-history-apis.html#windowproxy-setprototypeof><span class=secno>7.2.3.2</span> [[SetPrototypeOf]] ( <var>V</var> )</a><li><a href=nav-history-apis.html#windowproxy-isextensible><span class=secno>7.2.3.3</span> [[IsExtensible]] ( )</a><li><a href=nav-history-apis.html#windowproxy-preventextensions><span class=secno>7.2.3.4</span> [[PreventExtensions]] ( )</a><li><a href=nav-history-apis.html#windowproxy-getownproperty><span class=secno>7.2.3.5</span> [[GetOwnProperty]] ( <var>P</var> )</a><li><a href=nav-history-apis.html#windowproxy-defineownproperty><span class=secno>7.2.3.6</span> [[DefineOwnProperty]] ( <var>P</var>, <var>Desc</var>
  )</a><li><a href=nav-history-apis.html#windowproxy-get><span class=secno>7.2.3.7</span> [[Get]] ( <var>P</var>, <var>Receiver</var> )</a><li><a href=nav-history-apis.html#windowproxy-set><span class=secno>7.2.3.8</span> [[Set]] ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</a><li><a href=nav-history-apis.html#windowproxy-delete><span class=secno>7.2.3.9</span> [[Delete]] ( <var>P</var> )</a><li><a href=nav-history-apis.html#windowproxy-ownpropertykeys><span class=secno>7.2.3.10</span> [[OwnPropertyKeys]] ( )</a></ol><li><a href=nav-history-apis.html#the-location-interface><span class=secno>7.2.4</span> The <code>Location</code> interface</a><ol><li><a href=nav-history-apis.html#location-getprototypeof><span class=secno>7.2.4.1</span> [[GetPrototypeOf]] ( )</a><li><a href=nav-history-apis.html#location-setprototypeof><span class=secno>7.2.4.2</span> [[SetPrototypeOf]] ( <var>V</var> )</a><li><a href=nav-history-apis.html#location-isextensible><span class=secno>7.2.4.3</span> [[IsExtensible]] ( )</a><li><a href=nav-history-apis.html#location-preventextensions><span class=secno>7.2.4.4</span> [[PreventExtensions]] ( )</a><li><a href=nav-history-apis.html#location-getownproperty><span class=secno>7.2.4.5</span> [[GetOwnProperty]] ( <var>P</var> )</a><li><a href=nav-history-apis.html#location-defineownproperty><span class=secno>7.2.4.6</span> [[DefineOwnProperty]] ( <var>P</var>, <var>Desc</var> )</a><li><a href=nav-history-apis.html#location-get><span class=secno>7.2.4.7</span> [[Get]] ( <var>P</var>, <var>Receiver</var> )</a><li><a href=nav-history-apis.html#location-set><span class=secno>7.2.4.8</span> [[Set]] ( <var>P</var>, <var>V</var>, <var>Receiver</var> )</a><li><a href=nav-history-apis.html#location-delete><span class=secno>7.2.4.9</span> [[Delete]] ( <var>P</var> )</a><li><a href=nav-history-apis.html#location-ownpropertykeys><span class=secno>7.2.4.10</span> [[OwnPropertyKeys]] ( )</a></ol><li><a href=nav-history-apis.html#the-history-interface><span class=secno>7.2.5</span> The <code>History</code> interface</a><li><a href=nav-history-apis.html#navigation-api><span class=secno>7.2.6</span> The navigation API</a><ol><li><a href=nav-history-apis.html#navigation-api-intro><span class=secno>7.2.6.1</span> Introduction</a><li><a href=nav-history-apis.html#navigation-interface><span class=secno>7.2.6.2</span> The <code>Navigation</code> interface</a><li><a href=nav-history-apis.html#navigation-api-core><span class=secno>7.2.6.3</span> Core infrastructure</a><li><a href=nav-history-apis.html#navigation-api-entry-updates><span class=secno>7.2.6.4</span> Initializing and updating the entry list</a><li><a href=nav-history-apis.html#the-navigationhistoryentry-interface><span class=secno>7.2.6.5</span> The <code>NavigationHistoryEntry</code> interface</a><li><a href=nav-history-apis.html#the-history-entry-list><span class=secno>7.2.6.6</span> The history entry list</a><li><a href=nav-history-apis.html#navigation-api-initiating-navigations><span class=secno>7.2.6.7</span> Initiating navigations</a><li><a href=nav-history-apis.html#ongoing-navigation-tracking><span class=secno>7.2.6.8</span> Ongoing navigation tracking</a><li><a href=nav-history-apis.html#navigation-activation-interface><span class=secno>7.2.6.9</span> The <code>NavigationActivation</code> interface</a><li><a href=nav-history-apis.html#the-navigate-event><span class=secno>7.2.6.10</span> The <code>navigate</code> event</a><ol><li><a href=nav-history-apis.html#the-navigateevent-interface><span class=secno>7.2.6.10.1</span> The <code>NavigateEvent</code> interface</a><li><a href=nav-history-apis.html#the-navigationprecommitcontroller-interface><span class=secno>7.2.6.10.2</span> The <code>NavigationPrecommitController</code> interface</a><li><a href=nav-history-apis.html#the-navigationdestination-interface><span class=secno>7.2.6.10.3</span> The <code>NavigationDestination</code> interface</a><li><a href=nav-history-apis.html#navigate-event-firing><span class=secno>7.2.6.10.4</span> Firing the event</a><li><a href=nav-history-apis.html#navigate-event-scroll-focus><span class=secno>7.2.6.10.5</span> Scroll and focus behavior</a></ol></ol><li><a href=nav-history-apis.html#nav-traversal-event-interfaces><span class=secno>7.2.7</span> Event interfaces</a><ol><li><a href=nav-history-apis.html#the-navigationcurrententrychangeevent-interface><span class=secno>7.2.7.1</span> The <code>NavigationCurrentEntryChangeEvent</code> interface</a><li><a href=nav-history-apis.html#the-popstateevent-interface><span class=secno>7.2.7.2</span> The <code>PopStateEvent</code> interface</a><li><a href=nav-history-apis.html#the-hashchangeevent-interface><span class=secno>7.2.7.3</span> The <code>HashChangeEvent</code> interface</a><li><a href=nav-history-apis.html#the-pageswapevent-interface><span class=secno>7.2.7.4</span> The <code>PageSwapEvent</code> interface</a><li><a href=nav-history-apis.html#the-pagerevealevent-interface><span class=secno>7.2.7.5</span> The <code>PageRevealEvent</code> interface</a><li><a href=nav-history-apis.html#the-pagetransitionevent-interface><span class=secno>7.2.7.6</span> The <code>PageTransitionEvent</code> interface</a><li><a href=nav-history-apis.html#the-beforeunloadevent-interface><span class=secno>7.2.7.7</span> The <code>BeforeUnloadEvent</code> interface</a></ol><li><a href=nav-history-apis.html#the-notrestoredreasons-interface><span class=secno>7.2.8</span> The <code>NotRestoredReasons</code> interface</a></ol></ol></ol><h3 id=nav-traversal-apis><span class=secno>7.2</span> APIs related to navigation and
  session history<a href=#nav-traversal-apis class=self-link></a></h3>

  

  <h4 id=cross-origin-objects><span class=secno>7.2.1</span> Security infrastructure for <code id=cross-origin-objects:window><a href=#window>Window</a></code>,
  <code id=cross-origin-objects:windowproxy><a href=#windowproxy>WindowProxy</a></code>, and <code id=cross-origin-objects:location><a href=#location>Location</a></code> objects<a href=#cross-origin-objects class=self-link></a></h4>

  <p>Although typically objects cannot be accessed across <a href=browsers.html#concept-origin id=cross-origin-objects:concept-origin>origins</a>, the
  web platform would not be true to itself if it did not have some legacy exceptions to that rule
  that the web depends upon.</p>

  <p>This section uses the terminology and typographic conventions from the JavaScript
  specification. <a href=references.html#refsJAVASCRIPT>[JAVASCRIPT]</a></p>


  <h5 id=integration-with-idl><span class=secno>7.2.1.1</span> Integration with IDL<a href=#integration-with-idl class=self-link></a></h5>

  <p>When <a id=integration-with-idl:perform-a-security-check href=https://webidl.spec.whatwg.org/#dfn-perform-a-security-check data-x-internal=perform-a-security-check>perform a security check</a> is invoked, with a <var>platformObject</var>,
  <var>identifier</var>, and <var>type</var>, run these steps:</p>

  <ol><li><p>If <var>platformObject</var> is not a <code id=integration-with-idl:window><a href=#window>Window</a></code> or <code id=integration-with-idl:location><a href=#location>Location</a></code> object,
   then return.<li>
    <p>For each <var>e</var> of <a href=#crossoriginproperties-(-o-) id=integration-with-idl:crossoriginproperties-(-o-)>CrossOriginProperties</a>(<var>platformObject</var>):</p>

    <ol><li>
      <p>If <a id=integration-with-idl:samevalue href=https://tc39.es/ecma262/#sec-samevalue data-x-internal=samevalue>SameValue</a>(<var>e</var>.[[Property]], <var>identifier</var>) is true,
      then:</p>

      <ol><li><p>If <var>type</var> is "<code>method</code>" and <var>e</var> has neither
       [[NeedsGet]] nor [[NeedsSet]], then return.<li><p>Otherwise, if <var>type</var> is "<code>getter</code>" and
       <var>e</var>.[[NeedsGet]] is true, then return.<li><p>Otherwise, if <var>type</var> is "<code>setter</code>" and
       <var>e</var>.[[NeedsSet]] is true, then return.</ol>
     </ol>
   <li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=integration-with-idl:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>platformObject</var>) is false, then
   throw a <a id=integration-with-idl:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=integration-with-idl:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>


  <h5 id=shared-internal-slot:-crossoriginpropertydescriptormap><span class=secno>7.2.1.2</span> Shared internal slot: [[CrossOriginPropertyDescriptorMap]]<a href=#shared-internal-slot:-crossoriginpropertydescriptormap class=self-link></a></h5>

  <p><code id=shared-internal-slot:-crossoriginpropertydescriptormap:window><a href=#window>Window</a></code> and <code id=shared-internal-slot:-crossoriginpropertydescriptormap:location><a href=#location>Location</a></code> objects both have a
  <dfn id=crossoriginpropertydescriptormap>[[CrossOriginPropertyDescriptorMap]]</dfn> internal slot, whose value is initially an empty
  map.</p>

  <p>The <a href=#crossoriginpropertydescriptormap id=shared-internal-slot:-crossoriginpropertydescriptormap:crossoriginpropertydescriptormap>[[CrossOriginPropertyDescriptorMap]]</a> internal slot contains a map
  with entries whose keys are (<var>currentGlobal</var>, <var>objectGlobal</var>,
  <var>propertyKey</var>)-tuples and values are property descriptors, as a memoization of what is
  visible to scripts when <var>currentGlobal</var> inspects a <code id=shared-internal-slot:-crossoriginpropertydescriptormap:window-2><a href=#window>Window</a></code> or
  <code id=shared-internal-slot:-crossoriginpropertydescriptormap:location-2><a href=#location>Location</a></code> object from <var>objectGlobal</var>. It is filled lazily by
  <a href=#crossorigingetownpropertyhelper-(-o,-p-) id=shared-internal-slot:-crossoriginpropertydescriptormap:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper</a>, which consults it on future lookups.</p>

  <p>User agents should allow a value held in the map to be garbage collected along with its
  corresponding key when nothing holds a reference to any part of the value. That is, as long as
  garbage collection is not observable.</p>

  <p class=example>For example, with <code>const href =
  Object.getOwnPropertyDescriptor(crossOriginLocation, "href").set</code> the value and its
  corresponding key in the map cannot be garbage collected as that would be observable.</p>

  <p>User agents may have an optimization whereby they remove key-value pairs from the map when
  <code id=shared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain><a href=browsers.html#dom-document-domain>document.domain</a></code> is set. This is not observable as <code id=shared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain-2><a href=browsers.html#dom-document-domain>document.domain</a></code> cannot revisit an earlier value.</p>

  <p class=example>For example, setting <code id=shared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain-3><a href=browsers.html#dom-document-domain>document.domain</a></code>
  to "<code>example.com</code>" on www.example.com means user agents can remove all
  key-value pairs from the map where part of the key is www.example.com, as that can never be part
  of the <a id=shared-internal-slot:-crossoriginpropertydescriptormap:concept-origin href=browsers.html#concept-origin>origin</a> again and therefore the corresponding value could never be retrieved
  from the map.</p>


  <h5 id=shared-abstract-operations><span class=secno>7.2.1.3</span> Shared abstract operations<a href=#shared-abstract-operations class=self-link></a></h5>

  <h6 id=crossoriginproperties-(-o-)><span class=secno>7.2.1.3.1</span> <dfn>CrossOriginProperties</dfn> ( <var>O</var> )<a href=#crossoriginproperties-(-o-) class=self-link></a></h6>

  <ol><li><p><a id=crossoriginproperties-(-o-):assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>O</var> is a <code id=crossoriginproperties-(-o-):location><a href=#location>Location</a></code> or <code id=crossoriginproperties-(-o-):window><a href=#window>Window</a></code>
   object.<li><p>If <var>O</var> is a <code id=crossoriginproperties-(-o-):location-2><a href=#location>Location</a></code> object, then return «
   { [[Property]]: "<code>href</code>", [[NeedsGet]]: false, [[NeedsSet]]: true },
   { [[Property]]: "<code>replace</code>" } ».<li><p>Return «
   { [[Property]]: "<code>window</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>self</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>location</code>", [[NeedsGet]]: true, [[NeedsSet]]: true },
   { [[Property]]: "<code>close</code>" },
   { [[Property]]: "<code>closed</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>focus</code>" },
   { [[Property]]: "<code>blur</code>" },
   { [[Property]]: "<code>frames</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>length</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>top</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>opener</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>parent</code>", [[NeedsGet]]: true, [[NeedsSet]]: false },
   { [[Property]]: "<code>postMessage</code>" } ».</ol>

  <p class=note>This abstract operation does not return a <a id=crossoriginproperties-(-o-):completion-record href=https://tc39.es/ecma262/#sec-completion-record-specification-type data-x-internal=completion-record>Completion Record</a>.</p>

  <p class=note>Indexed properties do not need to be safelisted in this algorithm, as they are
  handled directly by the <code id=crossoriginproperties-(-o-):windowproxy><a href=#windowproxy>WindowProxy</a></code> object.</p>

  <p>A JavaScript property name <var>P</var> is a <dfn id=cross-origin-accessible-window-property-name>cross-origin accessible window property
  name</dfn> if it is "<code>window</code>", "<code>self</code>", "<code>location</code>", "<code>close</code>", "<code>closed</code>",
  "<code>focus</code>", "<code>blur</code>", "<code>frames</code>",
  "<code>length</code>", "<code>top</code>", "<code>opener</code>",
  "<code>parent</code>", "<code>postMessage</code>", or an <a id=crossoriginproperties-(-o-):array-index-property-name href=https://webidl.spec.whatwg.org/#dfn-array-index-property-name data-x-internal=array-index-property-name>array index
  property name</a>.</p>

  <h6 id=crossoriginpropertyfallback-(-p-)><span class=secno>7.2.1.3.2</span> <dfn>CrossOriginPropertyFallback</dfn> ( <var>P</var> )<a href=#crossoriginpropertyfallback-(-p-) class=self-link></a></h6>

  <ol><li><p>If <var>P</var> is "<code>then</code>", <a id=crossoriginpropertyfallback-(-p-):symbol.tostringtag href=infrastructure.html#symbol.tostringtag>%Symbol.toStringTag%</a>,
   <a id=crossoriginpropertyfallback-(-p-):symbol.hasinstance href=infrastructure.html#symbol.hasinstance>%Symbol.hasInstance%</a>, or <a id=crossoriginpropertyfallback-(-p-):symbol.isconcatspreadable href=infrastructure.html#symbol.isconcatspreadable>%Symbol.isConcatSpreadable%</a>, then return
   <a id=crossoriginpropertyfallback-(-p-):propertydescriptor href=https://tc39.es/ecma262/#sec-property-descriptor-specification-type data-x-internal=propertydescriptor>PropertyDescriptor</a> {
   [[Value]]: undefined,
   [[Writable]]: false,
   [[Enumerable]]: false,
   [[Configurable]]: true }.<li><p>Throw a <a id=crossoriginpropertyfallback-(-p-):securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=crossoriginpropertyfallback-(-p-):domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h6 id=isplatformobjectsameorigin-(-o-)><span class=secno>7.2.1.3.3</span> <dfn>IsPlatformObjectSameOrigin</dfn> ( <var>O</var> )<a href=#isplatformobjectsameorigin-(-o-) class=self-link></a></h6>

  <ol><li><p>Return true if the <a id=isplatformobjectsameorigin-(-o-):current-settings-object href=webappapis.html#current-settings-object>current settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=isplatformobjectsameorigin-(-o-):concept-settings-object-origin>origin</a> is <a id=isplatformobjectsameorigin-(-o-):same-origin-domain href=browsers.html#same-origin-domain>same origin-domain</a> with
   <var>O</var>'s <a id=isplatformobjectsameorigin-(-o-):relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=isplatformobjectsameorigin-(-o-):concept-settings-object-origin-2>origin</a>, and false otherwise.</ol>

  <p class=note>This abstract operation does not return a <a id=isplatformobjectsameorigin-(-o-):completion-record href=https://tc39.es/ecma262/#sec-completion-record-specification-type data-x-internal=completion-record>Completion Record</a>.</p>

  <p class=note>Here the <a id=isplatformobjectsameorigin-(-o-):current-settings-object-2 href=webappapis.html#current-settings-object>current settings object</a> roughly corresponds to the "caller",
  because this check occurs before the <a href=https://tc39.es/ecma262/#sec-execution-contexts id=isplatformobjectsameorigin-(-o-):javascript-execution-context data-x-internal=javascript-execution-context>execution
  context</a> for the getter/setter/method in question makes its way onto the <a id=isplatformobjectsameorigin-(-o-):javascript-execution-context-stack href=https://tc39.es/ecma262/#execution-context-stack data-x-internal=javascript-execution-context-stack>JavaScript
  execution context stack</a>. For example, in the code <code>w.document</code>, this
  step is invoked before the <code id=isplatformobjectsameorigin-(-o-):dom-document-2><a href=#dom-document-2>document</a></code> getter is reached as part
  of the <a href=#windowproxy-get>[[Get]]</a> algorithm for the <code id=isplatformobjectsameorigin-(-o-):windowproxy><a href=#windowproxy>WindowProxy</a></code>
  <var>w</var>.</p>

  <h6 id=crossorigingetownpropertyhelper-(-o,-p-)><span class=secno>7.2.1.3.4</span> <dfn>CrossOriginGetOwnPropertyHelper</dfn> ( <var>O</var>, <var>P</var> )<a href=#crossorigingetownpropertyhelper-(-o,-p-) class=self-link></a></h6>

  <p class=note>If this abstract operation returns undefined and there is no custom behavior, the
  caller needs to throw a <a id=crossorigingetownpropertyhelper-(-o,-p-):securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=crossorigingetownpropertyhelper-(-o,-p-):domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>. In
  practice this is handled by the caller calling <a href=#crossoriginpropertyfallback-(-p-) id=crossorigingetownpropertyhelper-(-o,-p-):crossoriginpropertyfallback-(-p-)>CrossOriginPropertyFallback</a>.</p>

  <ol><li><p>Let <var>crossOriginKey</var> be a tuple consisting of the <a id=crossorigingetownpropertyhelper-(-o,-p-):current-settings-object href=webappapis.html#current-settings-object>current settings
   object</a>, <var>O</var>'s <a id=crossorigingetownpropertyhelper-(-o,-p-):relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings object</a>, and <var>P</var>.<li>
    <p>For each <var>e</var> of <a href=#crossoriginproperties-(-o-) id=crossorigingetownpropertyhelper-(-o,-p-):crossoriginproperties-(-o-)>CrossOriginProperties</a>(<var>O</var>):</p>

    <ol><li>
      <p>If <a id=crossorigingetownpropertyhelper-(-o,-p-):samevalue href=https://tc39.es/ecma262/#sec-samevalue data-x-internal=samevalue>SameValue</a>(<var>e</var>.[[Property]], <var>P</var>) is true, then:</p>

      <ol><li><p>If the value of the <a href=#crossoriginpropertydescriptormap id=crossorigingetownpropertyhelper-(-o,-p-):crossoriginpropertydescriptormap>[[CrossOriginPropertyDescriptorMap]]</a> internal slot of
       <var>O</var> contains an entry whose key is <var>crossOriginKey</var>, then return that
       entry's value.<li><p>Let <var>originalDesc</var> be <a id=crossorigingetownpropertyhelper-(-o,-p-):ordinarygetownproperty href=https://tc39.es/ecma262/#sec-ordinarygetownproperty data-x-internal=ordinarygetownproperty>OrdinaryGetOwnProperty</a>(<var>O</var>,
       <var>P</var>).<li><p>Let <var>crossOriginDesc</var> be undefined.<li>
        <p>If <var>e</var>.[[NeedsGet]] and <var>e</var>.[[NeedsSet]] are absent, then:</p>

        <ol><li><p>Let <var>value</var> be <var>originalDesc</var>.[[Value]].<li><p>If <a id=crossorigingetownpropertyhelper-(-o,-p-):iscallable href=https://tc39.es/ecma262/#sec-iscallable data-x-internal=iscallable>IsCallable</a>(<var>value</var>) is true, then set <var>value</var> to
         an anonymous built-in function, created in the <a id=crossorigingetownpropertyhelper-(-o,-p-):current-realm href=https://tc39.es/ecma262/#current-realm data-x-internal=current-realm>current realm</a>, that performs
         the same steps as the IDL operation <var>P</var> on object <var>O</var>.<li><p>Set <var>crossOriginDesc</var> to <a id=crossorigingetownpropertyhelper-(-o,-p-):propertydescriptor href=https://tc39.es/ecma262/#sec-property-descriptor-specification-type data-x-internal=propertydescriptor>PropertyDescriptor</a> {
         [[Value]]: <var>value</var>,
         [[Enumerable]]: false,
         [[Writable]]: false,
         [[Configurable]]: true }.</ol>
       <li>
        <p>Otherwise:</p>

        <ol><li><p>Let <var>crossOriginGet</var> be undefined.<li><p>If <var>e</var>.[[NeedsGet]] is true, then set <var>crossOriginGet</var> to an
         anonymous built-in function, created in the <a id=crossorigingetownpropertyhelper-(-o,-p-):current-realm-2 href=https://tc39.es/ecma262/#current-realm data-x-internal=current-realm>current realm</a>, that performs the
         same steps as the getter of the IDL attribute <var>P</var> on object
         <var>O</var>.<li><p>Let <var>crossOriginSet</var> be undefined.<li><p>If <var>e</var>.[[NeedsSet]] is true, then set <var>crossOriginSet</var> to an
         anonymous built-in function, created in the <a id=crossorigingetownpropertyhelper-(-o,-p-):current-realm-3 href=https://tc39.es/ecma262/#current-realm data-x-internal=current-realm>current realm</a>, that performs the
         same steps as the setter of the IDL attribute <var>P</var> on object
         <var>O</var>.<li><p>Set <var>crossOriginDesc</var> to <a id=crossorigingetownpropertyhelper-(-o,-p-):propertydescriptor-2 href=https://tc39.es/ecma262/#sec-property-descriptor-specification-type data-x-internal=propertydescriptor>PropertyDescriptor</a> {
         [[Get]]: <var>crossOriginGet</var>,
         [[Set]]: <var>crossOriginSet</var>,
         [[Enumerable]]: false,
         [[Configurable]]: true }.</ol>
       <li><p>Create an entry in the value of the <a href=#crossoriginpropertydescriptormap id=crossorigingetownpropertyhelper-(-o,-p-):crossoriginpropertydescriptormap-2>[[CrossOriginPropertyDescriptorMap]]</a>
       internal slot of <var>O</var> with key <var>crossOriginKey</var> and value
       <var>crossOriginDesc</var>.<li><p>Return <var>crossOriginDesc</var>.</ol>
     </ol>
   <li><p>Return undefined.</ol>

  <p class=note>This abstract operation does not return a <a id=crossorigingetownpropertyhelper-(-o,-p-):completion-record href=https://tc39.es/ecma262/#sec-completion-record-specification-type data-x-internal=completion-record>Completion Record</a>.</p>

  <p class=note>The reason that the property descriptors produced here are configurable is to
  preserve the <a id=crossorigingetownpropertyhelper-(-o,-p-):invariants-of-the-essential-internal-methods href=https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internal=invariants-of-the-essential-internal-methods>invariants of the essential internal methods</a> required by the JavaScript
  specification. In particular, since the value of the property can change as a consequence of
  navigation, it is required that the property be configurable. (However, see <a href=https://github.com/tc39/ecma262/issues/672>tc39/ecma262 issue #672</a> and references to it
  elsewhere in this specification for cases where we are not able to preserve these invariants, for
  compatibility with existing web content.) <a href=references.html#refsJAVASCRIPT>[JAVASCRIPT]</a></p>

  <p class=note>The reason the property descriptors are non-enumerable, despite this mismatching
  the same-origin behavior, is for compatibility with existing web content. See <a href=https://github.com/whatwg/html/issues/3183>issue #3183</a> for details.</p>

  <h6 id=crossoriginget-(-o,-p,-receiver-)><span class=secno>7.2.1.3.5</span> <dfn>CrossOriginGet</dfn> ( <var>O</var>, <var>P</var>, <var>Receiver</var> )<a href=#crossoriginget-(-o,-p,-receiver-) class=self-link></a></h6>

  <ol><li><p>Let <var>desc</var> be ? <var>O</var>.[[GetOwnProperty]](<var>P</var>).<li><p><a id=crossoriginget-(-o,-p,-receiver-):assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>desc</var> is not undefined.<li><p>If <a id=crossoriginget-(-o,-p,-receiver-):isdatadescriptor href=https://tc39.es/ecma262/#sec-isdatadescriptor data-x-internal=isdatadescriptor>IsDataDescriptor</a>(<var>desc</var>) is true, then return
   <var>desc</var>.[[Value]].<li><p><a id=crossoriginget-(-o,-p,-receiver-):assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <a id=crossoriginget-(-o,-p,-receiver-):isaccessordescriptor href=https://tc39.es/ecma262/#sec-isaccessordescriptor data-x-internal=isaccessordescriptor>IsAccessorDescriptor</a>(<var>desc</var>) is true.<li><p>Let <var>getter</var> be <var>desc</var>.[[Get]].<li><p>If <var>getter</var> is undefined, then throw a <a id=crossoriginget-(-o,-p,-receiver-):securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=crossoriginget-(-o,-p,-receiver-):domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return ? <a id=crossoriginget-(-o,-p,-receiver-):call href=https://tc39.es/ecma262/#sec-call data-x-internal=call>Call</a>(<var>getter</var>, <var>Receiver</var>).</ol>

  <h6 id=crossoriginset-(-o,-p,-v,-receiver-)><span class=secno>7.2.1.3.6</span> <dfn>CrossOriginSet</dfn> ( <var>O</var>, <var>P</var>, <var>V</var>,
  <var>Receiver</var> )<a href=#crossoriginset-(-o,-p,-v,-receiver-) class=self-link></a></h6>

  <ol><li><p>Let <var>desc</var> be ? <var>O</var>.[[GetOwnProperty]](<var>P</var>).<li><p><a id=crossoriginset-(-o,-p,-v,-receiver-):assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>desc</var> is not undefined.<li>
    <p>If <var>desc</var>.[[Set]] is present and its value is not undefined, then:

    <ol><li><p>Perform ? <a id=crossoriginset-(-o,-p,-v,-receiver-):call href=https://tc39.es/ecma262/#sec-call data-x-internal=call>Call</a>(<var>desc</var>.[[Set]], <var>Receiver</var>,
     « <var>V</var> »).<li><p>Return true.</ol>
   <li><p>Throw a <a id=crossoriginset-(-o,-p,-v,-receiver-):securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=crossoriginset-(-o,-p,-v,-receiver-):domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h6 id=crossoriginownpropertykeys-(-o-)><span class=secno>7.2.1.3.7</span> <dfn>CrossOriginOwnPropertyKeys</dfn> ( <var>O</var> )<a href=#crossoriginownpropertykeys-(-o-) class=self-link></a></h6>

  <ol><li><p>Let <var>keys</var> be a new empty <a href=https://tc39.es/ecma262/#sec-list-and-record-specification-type id=crossoriginownpropertykeys-(-o-):js-list data-x-internal=js-list>List</a>.<li><p>For each <var>e</var> of <a href=#crossoriginproperties-(-o-) id=crossoriginownpropertykeys-(-o-):crossoriginproperties-(-o-)>CrossOriginProperties</a>(<var>O</var>), <a href=https://infra.spec.whatwg.org/#list-append id=crossoriginownpropertykeys-(-o-):list-append data-x-internal=list-append>append</a> <var>e</var>.[[Property]] to <var>keys</var>.<li><p>Return the concatenation of <var>keys</var> and « "<code>then</code>",
   <a id=crossoriginownpropertykeys-(-o-):symbol.tostringtag href=infrastructure.html#symbol.tostringtag>%Symbol.toStringTag%</a>, <a id=crossoriginownpropertykeys-(-o-):symbol.hasinstance href=infrastructure.html#symbol.hasinstance>%Symbol.hasInstance%</a>, <a id=crossoriginownpropertykeys-(-o-):symbol.isconcatspreadable href=infrastructure.html#symbol.isconcatspreadable>%Symbol.isConcatSpreadable%</a>
   ».</ol>

  <p class=note>This abstract operation does not return a <a id=crossoriginownpropertykeys-(-o-):completion-record href=https://tc39.es/ecma262/#sec-completion-record-specification-type data-x-internal=completion-record>Completion Record</a>.</p>

  


  <h4 id=the-window-object><span class=secno>7.2.2</span> The <code id=the-window-object:window><a href=#window>Window</a></code> object<a href=#the-window-object class=self-link></a></h4><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window title="The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.">Window</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div>

  <pre><code class='idl'>[<c- g>Global</c->=<c- n>Window</c->,
 <c- g>Exposed</c->=<c- n>Window</c->,
 <a id='the-window-object:legacyunenumerablenamedproperties' href='https://webidl.spec.whatwg.org/#LegacyUnenumerableNamedProperties' data-x-internal='legacyunenumerablenamedproperties'><c- g>LegacyUnenumerableNamedProperties</c-></a>]
<c- b>interface</c-> <dfn id='window' data-dfn-type='interface'><c- g>Window</c-></dfn> : <a id='the-window-object:eventtarget' href='https://dom.spec.whatwg.org/#interface-eventtarget' data-x-internal='eventtarget'><c- n>EventTarget</c-></a> {
  // the current browsing context
  [<a id='the-window-object:legacyunforgeable' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#windowproxy' id='the-window-object:windowproxy'><c- n>WindowProxy</c-></a> <a href='#dom-window' id='the-window-object:dom-window'><c- g>window</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#windowproxy' id='the-window-object:windowproxy-2'><c- n>WindowProxy</c-></a> <a href='#dom-self' id='the-window-object:dom-self'><c- g>self</c-></a>;
  [<a id='the-window-object:legacyunforgeable-2' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-window-object:document' href='dom.html#document'><c- n>Document</c-></a> <a href='#dom-document-2' id='the-window-object:dom-document-2'><c- g>document</c-></a>;
  <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-name' id='the-window-object:dom-name'><c- g>name</c-></a>; 
  [<c- g>PutForwards</c->=<a href='#dom-location-href' id='the-window-object:dom-location-href'><c- n>href</c-></a>, <a id='the-window-object:legacyunforgeable-3' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#location' id='the-window-object:location'><c- n>Location</c-></a> <a href='#dom-location' id='the-window-object:dom-location'><c- g>location</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#history-3' id='the-window-object:history-3'><c- n>History</c-></a> <a href='#dom-history' id='the-window-object:dom-history'><c- g>history</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigation' id='the-window-object:navigation'><c- n>Navigation</c-></a> <a href='#dom-navigation' id='the-window-object:dom-navigation'><c- g>navigation</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-window-object:customelementregistry' href='custom-elements.html#customelementregistry'><c- n>CustomElementRegistry</c-></a> <a href='custom-elements.html#dom-window-customelements' id='the-window-object:dom-window-customelements'><c- g>customElements</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop'><c- n>BarProp</c-></a> <a href='#dom-window-locationbar' id='the-window-object:dom-window-locationbar'><c- g>locationbar</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop-2'><c- n>BarProp</c-></a> <a href='#dom-window-menubar' id='the-window-object:dom-window-menubar'><c- g>menubar</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop-3'><c- n>BarProp</c-></a> <a href='#dom-window-personalbar' id='the-window-object:dom-window-personalbar'><c- g>personalbar</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop-4'><c- n>BarProp</c-></a> <a href='#dom-window-scrollbars' id='the-window-object:dom-window-scrollbars'><c- g>scrollbars</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop-5'><c- n>BarProp</c-></a> <a href='#dom-window-statusbar' id='the-window-object:dom-window-statusbar'><c- g>statusbar</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#barprop' id='the-window-object:barprop-6'><c- n>BarProp</c-></a> <a href='#dom-window-toolbar' id='the-window-object:dom-window-toolbar'><c- g>toolbar</c-></a>;
  <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-window-status' id='the-window-object:dom-window-status'><c- g>status</c-></a>;
  <c- b>undefined</c-> <a href='#dom-window-close' id='the-window-object:dom-window-close'><c- g>close</c-></a>();
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-window-closed' id='the-window-object:dom-window-closed'><c- g>closed</c-></a>;
  <c- b>undefined</c-> <a href='#dom-window-stop' id='the-window-object:dom-window-stop'><c- g>stop</c-></a>();
  <c- b>undefined</c-> <a href='interaction.html#dom-window-focus' id='the-window-object:dom-window-focus'><c- g>focus</c-></a>();
  <c- b>undefined</c-> <a href='interaction.html#dom-window-blur' id='the-window-object:dom-window-blur'><c- g>blur</c-></a>();

  // other browsing contexts
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#windowproxy' id='the-window-object:windowproxy-3'><c- n>WindowProxy</c-></a> <a href='#dom-frames' id='the-window-object:dom-frames'><c- g>frames</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <c- b>unsigned</c-> <c- b>long</c-> <a href='#dom-length' id='the-window-object:dom-length'><c- g>length</c-></a>;
  [<a id='the-window-object:legacyunforgeable-4' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#windowproxy' id='the-window-object:windowproxy-4'><c- n>WindowProxy</c-></a>? <a href='#dom-top' id='the-window-object:dom-top'><c- g>top</c-></a>;
  <c- b>attribute</c-> <c- b>any</c-> <a href='#dom-opener' id='the-window-object:dom-opener'><c- g>opener</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a href='#windowproxy' id='the-window-object:windowproxy-5'><c- n>WindowProxy</c-></a>? <a href='#dom-parent' id='the-window-object:dom-parent'><c- g>parent</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-window-object:element' href='https://dom.spec.whatwg.org/#interface-element' data-x-internal='element'><c- n>Element</c-></a>? <a href='#dom-frameelement' id='the-window-object:dom-frameelement'><c- g>frameElement</c-></a>;
  <a href='#windowproxy' id='the-window-object:windowproxy-6'><c- n>WindowProxy</c-></a>? <a href='#dom-open' id='the-window-object:dom-open'><c- g>open</c-></a>(<c- b>optional</c-> <c- b>USVString</c-> <c- g>url</c-> = &quot;&quot;, <c- b>optional</c-> <c- b>DOMString</c-> <c- g>target</c-> = &quot;_blank&quot;, <c- b>optional</c-> [<a id='the-window-object:legacynulltoemptystring' href='https://webidl.spec.whatwg.org/#LegacyNullToEmptyString' data-x-internal='legacynulltoemptystring'><c- g>LegacyNullToEmptyString</c-></a>] <c- b>DOMString</c-> <c- g>features</c-> = &quot;&quot;);

  // Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
  // object on the prototype chain. Indeed, this does not make the global object an exotic object.
  // Indexed access is taken care of by the <a href='#windowproxy' id='the-window-object:windowproxy-7'>WindowProxy</a> exotic object.
  <a href='#dom-window-nameditem'><c- b>getter</c-></a> <a href='https://webidl.spec.whatwg.org/#idl-object' id='the-window-object:idl-object' data-x-internal='idl-object'><c- b>object</c-></a> (<c- b>DOMString</c-> <c- g>name</c->);

  // the user agent
  <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-window-object:navigator' href='system-state.html#navigator'><c- n>Navigator</c-></a> <a href='system-state.html#dom-navigator' id='the-window-object:dom-navigator'><c- g>navigator</c-></a>;
  [<c- g>Replaceable</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-window-object:navigator-2' href='system-state.html#navigator'><c- n>Navigator</c-></a> <a href='system-state.html#dom-clientinformation' id='the-window-object:dom-clientinformation'><c- g>clientInformation</c-></a>; // legacy alias of .navigator
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='browsers.html#dom-originagentcluster' id='the-window-object:dom-originagentcluster'><c- g>originAgentCluster</c-></a>;

  // user prompts
  <c- b>undefined</c-> <a href='timers-and-user-prompts.html#dom-alert-noargs' id='the-window-object:dom-alert-noargs'><c- g>alert</c-></a>();
  <c- b>undefined</c-> <a href='timers-and-user-prompts.html#dom-alert' id='the-window-object:dom-alert'><c- g>alert</c-></a>(<c- b>DOMString</c-> <c- g>message</c->);
  <c- b>boolean</c-> <a href='timers-and-user-prompts.html#dom-confirm' id='the-window-object:dom-confirm'><c- g>confirm</c-></a>(<c- b>optional</c-> <c- b>DOMString</c-> <c- g>message</c-> = &quot;&quot;);
  <c- b>DOMString</c->? <a href='timers-and-user-prompts.html#dom-prompt' id='the-window-object:dom-prompt'><c- g>prompt</c-></a>(<c- b>optional</c-> <c- b>DOMString</c-> <c- g>message</c-> = &quot;&quot;, <c- b>optional</c-> <c- b>DOMString</c-> <c- g>default</c-> = &quot;&quot;);
  <c- b>undefined</c-> <a href='timers-and-user-prompts.html#dom-print' id='the-window-object:dom-print'><c- g>print</c-></a>();

  <c- b>undefined</c-> <a href='web-messaging.html#dom-window-postmessage' id='the-window-object:dom-window-postmessage'><c- g>postMessage</c-></a>(<c- b>any</c-> <c- g>message</c->, <c- b>USVString</c-> <c- g>targetOrigin</c->, <c- b>optional</c-> <c- b>sequence</c->&lt;<a href='https://webidl.spec.whatwg.org/#idl-object' id='the-window-object:idl-object-2' data-x-internal='idl-object'><c- b>object</c-></a>&gt; <c- g>transfer</c-> = []);
  <c- b>undefined</c-> <a href='web-messaging.html#dom-window-postmessage-options' id='the-window-object:dom-window-postmessage-options'><c- g>postMessage</c-></a>(<c- b>any</c-> <c- g>message</c->, <c- b>optional</c-> <a href='#windowpostmessageoptions' id='the-window-object:windowpostmessageoptions'><c- n>WindowPostMessageOptions</c-></a> <c- g>options</c-> = {});

  // <a href='obsolete.html#Window-partial'>also has obsolete members</a>
};
<a href='#window' id='the-window-object:window-2'><c- n>Window</c-></a> <c- b>includes</c-> <a id='the-window-object:globaleventhandlers' href='webappapis.html#globaleventhandlers'><c- n>GlobalEventHandlers</c-></a>;
<a href='#window' id='the-window-object:window-3'><c- n>Window</c-></a> <c- b>includes</c-> <a id='the-window-object:windoweventhandlers' href='webappapis.html#windoweventhandlers'><c- n>WindowEventHandlers</c-></a>;

<c- b>dictionary</c-> <dfn id='windowpostmessageoptions' data-dfn-type='dictionary'><c- g>WindowPostMessageOptions</c-></dfn> : <a id='the-window-object:structuredserializeoptions' href='web-messaging.html#structuredserializeoptions'><c- n>StructuredSerializeOptions</c-></a> {
  <c- b>USVString</c-> <dfn data-dfn-for='WindowPostMessageOptions' id='dom-windowpostmessageoptions-targetorigin' data-dfn-type='dict-member'><c- g>targetOrigin</c-></dfn> = &quot;/&quot;;
};</code></pre>

  <dl class=domintro><dt><code><var>window</var>.<a href=#dom-window id=dom-window-dev>window</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/window title="The window property of a Window object points to the window object itself.">Window/window</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-frames id=dom-frames-dev>frames</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/frames title="Returns the window itself, which is an array-like object, listing the direct sub-frames of the current window.">Window/frames</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-self id=dom-self-dev>self</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/self title="The Window.self read-only property returns the window itself, as a WindowProxy. It can be used with dot notation on a window object (that is, window.self) or standalone (self). The advantage of the standalone notation is that a similar notation exists for non-window contexts, such as in Web Workers. By using self, you can refer to the global scope in a way that will work not only in a window context (self will resolve to window.self) but also in a worker context (self will then resolve to WorkerGlobalScope.self).">Window/self</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>These attributes all return <var>window</var>.<dt><code><var>window</var>.<a href=#dom-document-2 id=dom-document-dev>document</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/document title="window.document returns a reference to the document contained in the window.">Window/document</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the <code id=the-window-object:document-2><a href=dom.html#document>Document</a></code> associated with <var>window</var>.<dt><code><var>document</var>.<a href=#dom-document-defaultview id=dom-document-defaultview-dev>defaultView</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView title="In browsers, document.defaultView returns the window object associated with a document, or null if none is available.">Document/defaultView</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>9+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the <code id=the-window-object:window-4><a href=#window>Window</a></code> associated with <var>document</var>, if there is one, or null otherwise.</dl>

  

  <p>The <code id=the-window-object:window-5><a href=#window>Window</a></code> object has an <dfn id=concept-document-window data-export="">associated
  <code>Document</code></dfn>, which is a <code id=the-window-object:document-3><a href=dom.html#document>Document</a></code> object. It is set when the
  <code id=the-window-object:window-6><a href=#window>Window</a></code> object is created, and only ever changed during <a href=browsing-the-web.html#navigate id=the-window-object:navigate>navigation</a> from the <a href=dom.html#is-initial-about:blank id=the-window-object:is-initial-about:blank>initial
  <code>about:blank</code></a> <code id=the-window-object:document-4><a href=dom.html#document>Document</a></code>.</p>

  <p>A <code id=the-window-object:window-7><a href=#window>Window</a></code>'s <dfn data-dfn-for=Window id=window-bc data-export="">browsing context</dfn> is
  its <a href=#concept-document-window id=the-window-object:concept-document-window>associated <code>Document</code></a>'s <a href=document-sequences.html#concept-document-bc id=the-window-object:concept-document-bc>browsing context</a>. <span class=note>It is either null or a
  <a id=the-window-object:browsing-context href=document-sequences.html#browsing-context>browsing context</a>.</span></p>

  <p>A <code id=the-window-object:window-8><a href=#window>Window</a></code>'s <dfn data-dfn-for=Window id=window-navigable data-export="">navigable</dfn> is
  the <a id=the-window-object:navigable href=document-sequences.html#navigable>navigable</a> whose <a href=document-sequences.html#nav-document id=the-window-object:nav-document>active document</a> is the
  <code id=the-window-object:window-9><a href=#window>Window</a></code>'s <a href=#concept-document-window id=the-window-object:concept-document-window-2>associated
  <code>Document</code></a>'s, or null if there is no such <a id=the-window-object:navigable-2 href=document-sequences.html#navigable>navigable</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window data-dfn-type=attribute><code>window</code></dfn>, <dfn data-dfn-for=Window id=dom-frames data-dfn-type=attribute><code>frames</code></dfn>, and <dfn data-dfn-for=Window id=dom-self data-dfn-type=attribute><code>self</code></dfn> getter steps are to return <a id=the-window-object:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=webappapis.html#concept-relevant-realm id=the-window-object:concept-relevant-realm>relevant realm</a>.[[GlobalEnv]].[[GlobalThisValue]].</p>

  <p>The <dfn data-dfn-for=Window id=dom-document-2 data-dfn-type=attribute><code>document</code></dfn> getter steps
  are to return <a id=the-window-object:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-document-window id=the-window-object:concept-document-window-3>associated
  <code>Document</code></a>.</p>

  <p class=note>The <code id=the-window-object:document-5><a href=dom.html#document>Document</a></code> object associated with a <code id=the-window-object:window-10><a href=#window>Window</a></code> object can
  change in exactly one case: when the <a id=the-window-object:navigate-2 href=browsing-the-web.html#navigate>navigate</a> algorithm <a href=document-lifecycle.html#initialise-the-document-object id=the-window-object:initialise-the-document-object>creates a new <code>Document</code> object</a> for the
  first page loaded in a <a id=the-window-object:browsing-context-2 href=document-sequences.html#browsing-context>browsing context</a>. In that specific case, the
  <code id=the-window-object:window-11><a href=#window>Window</a></code> object of the <a href=dom.html#is-initial-about:blank id=the-window-object:is-initial-about:blank-2>initial
  <code>about:blank</code></a> page is reused and gets a new <code id=the-window-object:document-6><a href=dom.html#document>Document</a></code> object.</p>

  <p>The <dfn data-dfn-for=Document id=dom-document-defaultview data-dfn-type=attribute><code>defaultView</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-window-object:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=document-sequences.html#concept-document-bc id=the-window-object:concept-document-bc-2>browsing context</a> is null,
   then return null.<li><p>Return <a id=the-window-object:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=document-sequences.html#concept-document-bc id=the-window-object:concept-document-bc-3>browsing context</a>'s
   <code id=the-window-object:windowproxy-8><a href=#windowproxy>WindowProxy</a></code> object.</ol>

  <hr>

  <div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument title="For historical reasons, Window objects have a window.HTMLDocument property whose value is the Document interface. So you can think of HTMLDocument as an alias for Document, and you can find documentation for HTMLDocument members under the documentation for the Document interface.">HTMLDocument</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><p>For historical reasons, <code id=the-window-object:window-12><a href=#window>Window</a></code> objects must also have a writable, configurable,
  non-enumerable property named <dfn id=htmldocument><code>HTMLDocument</code></dfn> whose value is the
  <code id=the-window-object:document-7><a href=dom.html#document>Document</a></code> <a id=the-window-object:interface-object href=https://webidl.spec.whatwg.org/#dfn-interface-object data-x-internal=interface-object>interface object</a>.</p>

  


  <h5 id=apis-for-creating-and-navigating-browsing-contexts-by-name><span class=secno>7.2.2.1</span> Opening and closing windows<a href=#apis-for-creating-and-navigating-browsing-contexts-by-name class=self-link></a></h5>

  <dl class=domintro><dt><code><var>window</var> = <var>window</var>.<a href=#dom-open id=dom-open-dev>open</a>([ <var>url</var> [, <var>target</var> [, <var>features</var> ] ] ])</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/open title="The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.">Window/open</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd>
    <p>Opens a window to show <var>url</var> (defaults to "<code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank><a href=infrastructure.html#about:blank>about:blank</a></code>"), and returns
    it. <var>target</var> (defaults to "<code>_blank</code>") gives the name of the new
    window. If a window already exists with that name, it is reused. The <var>features</var>
    argument can contain a <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:set-of-comma-separated-tokens href=common-microsyntaxes.html#set-of-comma-separated-tokens>set of comma-separated tokens</a>:</p>

    <dl><dt>"<code>noopener</code>"<dt>"<code>noreferrer</code>"<dd><p>These behave equivalently to the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:link-type-noopener><a href=links.html#link-type-noopener>noopener</a></code> and <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:link-type-noreferrer><a href=links.html#link-type-noreferrer>noreferrer</a></code> link types on <a href=links.html#hyperlink id=apis-for-creating-and-navigating-browsing-contexts-by-name:hyperlink>hyperlinks</a>.<dt>"<code>popup</code>"<dd><p>Encourages user agents to provide a minimal web browser user interface for the new
     window. (Impacts the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-barprop-visible><a href=#dom-barprop-visible>visible</a></code> getter on all
     <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:barprop><a href=#barprop>BarProp</a></code> objects as well.)</dl>

    <pre class=example><code class='js'>globalThis<c- p>.</c->open<c- p>(</c-><c- u>&quot;https://email.example/message/CAOOOkFcWW97r8yg=SsWg7GgCmp4suVX9o85y8BvNRqMjuc5PXg&quot;</c-><c- p>,</c-> <c- kc>undefined</c-><c- p>,</c-> <c- u>&quot;noopener,popup&quot;</c-><c- p>);</c-></code></pre>
   <dt><code><var>window</var>.<a href=#dom-name id=dom-name-dev>name</a> [ = <var>value</var> ]</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/name title="The Window.name property gets/sets the name of the window's browsing context.">Window/name</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the name of the window.</p>

    <p>Can be set, to change the name.</p>
   <dt><code><var>window</var>.<a href=#dom-window-close id=dom-window-close-dev>close</a>()</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/close title="The Window.close() method closes the current window, or the window on which it was called.">Window/close</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd><p>Closes the window.<dt><code><var>window</var>.<a href=#dom-window-closed id=dom-window-closed-dev>closed</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/closed title="The Window.closed read-only property indicates whether the referenced window is closed or not.">Window/closed</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns true if the window has been closed, false otherwise.<dt><code><var>window</var>.<a href=#dom-window-stop id=dom-window-stop-dev>stop</a>()</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/stop title="The window.stop() stops further resource loading in the current browsing context, equivalent to the stop button in the browser.">Window/stop</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Cancels the document load.</dl>

  

  <p>To <dfn id=get-noopener-for-window-open>get noopener for window open</dfn>, given a <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:document><a href=dom.html#document>Document</a></code>
  <var>sourceDocument</var>, an <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:ordered-map href=https://infra.spec.whatwg.org/#ordered-map data-x-internal=ordered-map>ordered map</a> <var>tokenizedFeatures</var>, and a
  <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:url-record href=https://url.spec.whatwg.org/#concept-url data-x-internal=url-record>URL record</a>-or-null <var>url</var>, perform the following steps. They return a
  boolean.</p>

  <ol><li>
    <p>If <var>url</var> is not null and <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-blob-entry id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-url-blob-entry data-x-internal=concept-url-blob-entry>blob URL entry</a> is not null:</p>

    <ol><li><p>Let <var>blobOrigin</var> be <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-blob-entry id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-url-blob-entry-2 data-x-internal=concept-url-blob-entry>blob URL entry</a>'s <a href=https://w3c.github.io/FileAPI/#blob-url-entry-environment id=apis-for-creating-and-navigating-browsing-contexts-by-name:blob-url-entry-environment data-x-internal=blob-url-entry-environment>environment</a>'s <a href=webappapis.html#concept-settings-object-origin id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-settings-object-origin>origin</a>.<li><p>Let <var>topLevelOrigin</var> be <var>sourceDocument</var>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings
     object</a>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-environment-top-level-origin href=webappapis.html#concept-environment-top-level-origin>top-level origin</a>.<li><p>If <var>blobOrigin</var> is not <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:same-site href=browsers.html#same-site>same site</a> with <var>topLevelOrigin</var>,
     then return true.</ol>
   <li><p>Let <var>noopener</var> be false.<li><p>If <var>tokenizedFeatures</var>["<code>noopener</code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-exists data-x-internal=map-exists>exists</a>, then set <var>noopener</var> to the result of <a href=#concept-window-open-features-parse-boolean id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-parse-boolean>parsing <var>tokenizedFeatures</var>["<code>noopener</code>"] as a boolean feature</a>.<li><p>Return <var>noopener</var>.</ol>

  <p>The <dfn id=window-open-steps>window open steps</dfn>, given a string <var>url</var>, a string <var>target</var>,
  and a string <var>features</var>, are as follows:</p>

  <ol><li><p>If the <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:event-loop href=webappapis.html#event-loop>event loop</a>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:termination-nesting-level href=document-lifecycle.html#termination-nesting-level>termination nesting level</a> is nonzero,
   then return null.<li><p>Let <var>sourceDocument</var> be the <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:entry-global-object href=webappapis.html#entry-global-object>entry global object</a>'s <a href=#concept-document-window id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-document-window>associated <code>Document</code></a>.<li><p>Let <var>urlRecord</var> be null.<li>
    <p>If <var>url</var> is not the empty string, then:</p>

    <ol><li><p>Set <var>urlRecord</var> to the result of <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:encoding-parsing-a-url href=urls-and-fetching.html#encoding-parsing-a-url>encoding-parsing a URL</a> given
     <var>url</var>, relative to <var>sourceDocument</var>.<li><p>If <var>urlRecord</var> is failure, then throw a <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:syntaxerror href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a>
     <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>
   <li><p>If <var>target</var> is the empty string, then set <var>target</var> to "<code>_blank</code>".<li><p>Let <var>tokenizedFeatures</var> be the result of <a href=#concept-window-open-features-tokenize id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-tokenize>tokenizing</a> <var>features</var>.<li><p>Let <var>noreferrer</var> be false.<li><p>If <var>tokenizedFeatures</var>["<code>noreferrer</code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-exists-2 data-x-internal=map-exists>exists</a>, then set <var>noreferrer</var> to the result of <a href=#concept-window-open-features-parse-boolean id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-parse-boolean-2>parsing <var>tokenizedFeatures</var>["<code>noreferrer</code>"] as a boolean feature</a>.<li><p>Let <var>noopener</var> be the result of <a href=#get-noopener-for-window-open id=apis-for-creating-and-navigating-browsing-contexts-by-name:get-noopener-for-window-open>getting noopener for window open</a> with
   <var>sourceDocument</var>, <var>tokenizedFeatures</var>, and <var>urlRecord</var>.<li><p><a href=https://infra.spec.whatwg.org/#map-remove id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-remove data-x-internal=map-remove>Remove</a> <var>tokenizedFeatures</var>["<code>noopener</code>"] and <var>tokenizedFeatures</var>["<code>noreferrer</code>"].<li><p>Let <var>referrerPolicy</var> be the empty string.<li><p>If <var>noreferrer</var> is true, then set <var>noopener</var> to true and set
   <var>referrerPolicy</var> to "<code>no-referrer</code>".<li>
    <p>Let <var>targetNavigable</var> and <var>windowType</var> be the result of applying <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-rules-for-choosing-a-navigable href=document-sequences.html#the-rules-for-choosing-a-navigable>the
    rules for choosing a navigable</a> given <var>target</var>, <var>sourceDocument</var>'s
    <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:node-navigable href=document-sequences.html#node-navigable>node navigable</a>, and <var>noopener</var>.</p>

    <p class=example>If there is a user agent that supports control-clicking a link to open it in
    a new tab, and the user control-clicks on an element whose <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:handler-onclick><a href=webappapis.html#handler-onclick>onclick</a></code> handler uses the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-open><a href=#dom-open>window.open()</a></code> API to open a page in an <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-iframe-element><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code> element,
    the user agent could override the selection of the target browsing context to instead target a
    new tab.</p>
   <li><p>If <var>targetNavigable</var> is null, then return null.<li>
    <p>If <var>windowType</var> is either "<code>new and unrestricted</code>" or "<code>new with no opener</code>", then:</p>

    <ol><li><p>Set <var>targetNavigable</var>'s <a href=document-sequences.html#nav-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-bc>active browsing context</a>'s
     <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-popup href=document-sequences.html#is-popup>is popup</a> to the result of <a href=#popup-window-is-requested id=apis-for-creating-and-navigating-browsing-contexts-by-name:popup-window-is-requested>checking if a
     popup window is requested</a>, given <var>tokenizedFeatures</var>.<li><p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:set-up-browsing-context-features href=https://drafts.csswg.org/cssom-view/#set-up-browsing-context-features data-x-internal=set-up-browsing-context-features>Set up browsing context features</a> for <var>targetNavigable</var>'s <a href=document-sequences.html#nav-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-bc-2>active browsing context</a> given
     <var>tokenizedFeatures</var>. <a href=references.html#refsCSSOMVIEW>[CSSOMVIEW]</a><li><p>If <var>urlRecord</var> is null, then set <var>urlRecord</var> to a <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:url-record-2 href=https://url.spec.whatwg.org/#concept-url data-x-internal=url-record>URL
     record</a> representing <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-2><a href=infrastructure.html#about:blank>about:blank</a></code>.<li>
      <p>If <var>urlRecord</var> <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:matches-about:blank href=urls-and-fetching.html#matches-about:blank>matches <code>about:blank</code></a>, then perform the
      <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:url-and-history-update-steps href=browsing-the-web.html#url-and-history-update-steps>URL and history update steps</a> given <var>targetNavigable</var>'s <a href=document-sequences.html#nav-document id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-document>active document</a> and <var>urlRecord</var>.</p>

      <p class=note>This is necessary in case <var>url</var> is something like <code>about:blank?foo</code>. If <var>url</var> is just plain <code>about:blank</code>, this will do nothing.</p>
     <li><p>Otherwise, <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate href=browsing-the-web.html#navigate>navigate</a> <var>targetNavigable</var>
     to <var>urlRecord</var> using <var>sourceDocument</var>, with <i id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigation-referrer-policy><a href=browsing-the-web.html#navigation-referrer-policy>referrerPolicy</a></i> set to <var>referrerPolicy</var> and
     <i><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:exceptions-enabled href=browsing-the-web.html#exceptions-enabled>exceptionsEnabled</a></i> set to true.</ol>
   <li>
    <p>Otherwise:</p>

    <ol><li><p>If <var>urlRecord</var> is not null, then
     <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-2 href=browsing-the-web.html#navigate>navigate</a> <var>targetNavigable</var> to <var>urlRecord</var> using
     <var>sourceDocument</var>, with <i id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigation-referrer-policy-2><a href=browsing-the-web.html#navigation-referrer-policy>referrerPolicy</a></i> set
     to <var>referrerPolicy</var> and <i><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:exceptions-enabled-2 href=browsing-the-web.html#exceptions-enabled>exceptionsEnabled</a></i> set to true.<li><p>If <var>noopener</var> is false, then set <var>targetNavigable</var>'s <a href=document-sequences.html#nav-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-bc-3>active browsing context</a>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:opener-browsing-context href=document-sequences.html#opener-browsing-context>opener browsing context</a> to
     <var>sourceDocument</var>'s <a href=document-sequences.html#concept-document-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-document-bc>browsing
     context</a>.</ol>
   <li><p>If <var>noopener</var> is true or <var>windowType</var> is "<code>new with no
   opener</code>", then return null.<li><p>Return <var>targetNavigable</var>'s <a href=document-sequences.html#nav-wp id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-wp>active
   <code>WindowProxy</code></a>.</ol>

  <p>The <dfn data-dfn-for=Window id=dom-open data-dfn-type=method><code>open(<var>url</var>, <var>target</var>,
  <var>features</var>)</code></dfn> method steps are to run the <a href=#window-open-steps id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-open-steps>window open steps</a> with
  <var>url</var>, <var>target</var>, and <var>features</var>.</p>

  <p class=note>The method provides a mechanism for <a href=browsing-the-web.html#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-3>navigating</a> an
  existing <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context href=document-sequences.html#browsing-context>browsing context</a> or opening and navigating an <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:auxiliary-browsing-context href=document-sequences.html#auxiliary-browsing-context>auxiliary browsing
  context</a>.</p>

  <hr>

  <p>To <dfn id=concept-window-open-features-tokenize>tokenize the <var>features</var>
  argument</dfn>:</p>

  <ol><li><p>Let <var>tokenizedFeatures</var> be a new <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:ordered-map-2 href=https://infra.spec.whatwg.org/#ordered-map data-x-internal=ordered-map>ordered map</a>.<li><p>Let <var>position</var> point at the first code point of <var>features</var>.<li>
    <p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:while href=https://infra.spec.whatwg.org/#iteration-while data-x-internal=while>While</a> <var>position</var> is not past the end of <var>features</var>:</p>

    <ol><li><p>Let <var>name</var> be the empty string.<li><p>Let <var>value</var> be the empty string.<li><p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points href=https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internal=collect-a-sequence-of-code-points>Collect a sequence of code points</a> that are <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator>feature separators</a> from <var>features</var> given <var>position</var>. This
     skips past leading separators before the name.<li><p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points-2 href=https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internal=collect-a-sequence-of-code-points>Collect a sequence of code points</a> that are not <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-2>feature separators</a> from <var>features</var> given <var>position</var>. Set
     <var>name</var> to the collected characters, <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:converted-to-ascii-lowercase href=https://infra.spec.whatwg.org/#ascii-lowercase data-x-internal=converted-to-ascii-lowercase>converted to ASCII lowercase</a>.<li><p>Set <var>name</var> to the result of <a href=#normalizing-the-feature-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:normalizing-the-feature-name>normalizing the feature name</a>
     <var>name</var>.<li>
      <p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:while-2 href=https://infra.spec.whatwg.org/#iteration-while data-x-internal=while>While</a> <var>position</var> is not past the end of <var>features</var> and the
      code point at <var>position</var> in <var>features</var> is not U+003D (=):</p>

      <ol><li><p>If the code point at <var>position</var> in <var>features</var> is U+002C (,), or if
       it is not a <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-3>feature separator</a>, then <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:break href=https://infra.spec.whatwg.org/#iteration-break data-x-internal=break>break</a>.<li><p>Advance <var>position</var> by 1.</ol>

      <p class=note>This skips to the first U+003D (=) but does not skip past a U+002C (,) or a
      non-separator.</p>
     <li>
      <p>If the code point at <var>position</var> in <var>features</var> is a <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-4>feature
      separator</a>:</p>

      <ol><li>
        <p>While <var>position</var> is not past the end of <var>features</var> and the code point
        at <var>position</var> in <var>features</var> is a <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-5>feature separator</a>:</p>

        <ol><li><p>If the code point at <var>position</var> in <var>features</var> is U+002C (,), then
         <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:break-2 href=https://infra.spec.whatwg.org/#iteration-break data-x-internal=break>break</a>.<li><p>Advance <var>position</var> by 1.</ol>

        <p class=note>This skips to the first non-separator but does not skip past a U+002C
        (,).</p>
       <li><p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points-3 href=https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internal=collect-a-sequence-of-code-points>Collect a sequence of code points</a> that are not <a href=#feature-separator id=apis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-6>feature separators</a> code points from <var>features</var> given
       <var>position</var>. Set <var>value</var> to the collected code points, <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:converted-to-ascii-lowercase-2 href=https://infra.spec.whatwg.org/#ascii-lowercase data-x-internal=converted-to-ascii-lowercase>converted to
       ASCII lowercase</a>.</ol>
     <li><p>If <var>name</var> is not the empty string, then set
     <var>tokenizedFeatures</var>[<var>name</var>] to <var>value</var>.</ol>
   <li><p>Return <var>tokenizedFeatures</var>.</ol>

  <p>To <dfn id=window-feature-is-set>check if a window feature is set</dfn>, given
  <var>tokenizedFeatures</var>, <var>featureName</var>, and <var>defaultValue</var>:</p>

  <ol><li><p>If <var>tokenizedFeatures</var>[<var>featureName</var>] <a href=https://infra.spec.whatwg.org/#map-exists id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-exists-3 data-x-internal=map-exists>exists</a>, then return the result of <a href=#concept-window-open-features-parse-boolean id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-parse-boolean-3>parsing
   <var>tokenizedFeatures</var>[<var>featureName</var>] as a boolean feature</a>.<li><p>Return <var>defaultValue</var>.</ol>

  <p>To <dfn id=popup-window-is-requested>check if a popup window is requested</dfn>, given
  <var>tokenizedFeatures</var>:</p>

  <ol><li><p>If <var>tokenizedFeatures</var> is <a href=https://infra.spec.whatwg.org/#map-is-empty id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-empty data-x-internal=map-empty>empty</a>, then return
   false.<li><p>If <var>tokenizedFeatures</var>["<code>popup</code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=apis-for-creating-and-navigating-browsing-contexts-by-name:map-exists-4 data-x-internal=map-exists>exists</a>, then return the result of <a href=#concept-window-open-features-parse-boolean id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-parse-boolean-4>parsing
   <var>tokenizedFeatures</var>["<code>popup</code>"] as a boolean
   feature</a>.<li><p>Let <var>location</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set>checking if
   a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>location</code>", and false.<li><p>Let <var>toolbar</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set-2>checking if
   a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>toolbar</code>", and false.<li><p>If <var>location</var> and <var>toolbar</var> are both false, then return true.<li><p>Let <var>menubar</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set-3>checking if
   a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>menubar</code>", and false.<li><p>If <var>menubar</var> is false, then return true.<li><p>Let <var>resizable</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set-4>checking if
   a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>resizable</code>", and true.<li><p>If <var>resizable</var> is false, then return true.<li><p>Let <var>scrollbars</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set-5>checking
   if a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>scrollbars</code>", and false.<li><p>If <var>scrollbars</var> is false, then return true.<li><p>Let <var>status</var> be the result of <a href=#window-feature-is-set id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-feature-is-set-6>checking if
   a window feature is set</a>, given <var>tokenizedFeatures</var>, "<code>status</code>", and false.<li><p>If <var>status</var> is false, then return true.<li><p>Return false.</ol>

  <p>A code point is a <dfn id=feature-separator>feature separator</dfn> if it is <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:space-characters href=https://infra.spec.whatwg.org/#ascii-whitespace data-x-internal=space-characters>ASCII whitespace</a>, U+003D
  (=), or U+002C (,).</p>

  <p>For legacy reasons, there are some aliases of some feature names. To <dfn id=normalizing-the-feature-name>normalize a feature name</dfn> <var>name</var>, switch on <var>name</var>:</p>

  <dl class=switch><dt>"<code>screenx</code>"
   <dd>Return "<code>left</code>".
   <dt>"<code>screeny</code>"
   <dd>Return "<code>top</code>".
   <dt>"<code>innerwidth</code>"
   <dd>Return "<code>width</code>".
   <dt>"<code>innerheight</code>"
   <dd>Return "<code>height</code>".
   <dt>Anything else
   <dd>Return <var>name</var>.
  </dl>

  <p>To <dfn id=concept-window-open-features-parse-boolean>parse a boolean feature</dfn> given
  a string <var>value</var>:</p>

  <ol><li><p>If <var>value</var> is the empty string, then return true.<li><p>If <var>value</var> <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is href=https://infra.spec.whatwg.org/#string-is data-x-internal=is>is</a> "<code>yes</code>", then return
   true.<li><p>If <var>value</var> <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-2 href=https://infra.spec.whatwg.org/#string-is data-x-internal=is>is</a> "<code>true</code>", then return
   true.<li><p>Let <var>parsed</var> be the result of <a href=common-microsyntaxes.html#rules-for-parsing-integers id=apis-for-creating-and-navigating-browsing-contexts-by-name:rules-for-parsing-integers>parsing
   <var>value</var> as an integer</a>.<li><p>If <var>parsed</var> is an error, then set it to 0.<li><p>Return false if <var>parsed</var> is 0, and true otherwise.</ol>

  <hr>

  <p>The <dfn data-dfn-for=Window id=dom-name data-dfn-type=attribute><code>name</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable>navigable</a> is null, then
   return the empty string.<li><p>Return <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-2>navigable</a>'s <a href=document-sequences.html#nav-target id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-target>target name</a>.</ol>

  <p>The <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-name><a href=#dom-name>name</a></code> setter steps are:</p>

  <ol><li><p>If <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-3>navigable</a> is null, then
   return.<li><p>Set <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-4>navigable</a>'s <a href=document-sequences.html#nav-active-history-entry id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-active-history-entry>active session history entry</a>'s <a href=browsing-the-web.html#she-document-state id=apis-for-creating-and-navigating-browsing-contexts-by-name:she-document-state>document state</a>'s <a href=browsing-the-web.html#document-state-nav-target-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:document-state-nav-target-name>navigable target name</a> to the given value.</ol>

  <p class=note>The name <a href=browsing-the-web.html#resetBCName>gets reset</a> when the navigable is <a href=browsing-the-web.html#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-4>navigated</a> to another <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-origin href=browsers.html#concept-origin>origin</a>.</p>

  <hr>

  <p>The <dfn data-dfn-for=Window id=dom-window-close data-dfn-type=method><code>close()</code></dfn> method steps
  are:</p>

  <ol><li><p>Let <var>thisTraversable</var> be <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-5>navigable</a>.<li><p>If <var>thisTraversable</var> is not a <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:top-level-traversable href=document-sequences.html#top-level-traversable>top-level traversable</a>, then
   return.<li><p>If <var>thisTraversable</var>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-closing href=document-sequences.html#is-closing>is closing</a> is true, then return.<li><p>Let <var>browsingContext</var> be <var>thisTraversable</var>'s <a href=document-sequences.html#nav-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-bc-4>active browsing context</a>.<li><p>Let <var>sourceSnapshotParams</var> be the result of <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:snapshotting-source-snapshot-params href=browsing-the-web.html#snapshotting-source-snapshot-params>snapshotting source snapshot
   params</a> given <var>thisTraversable</var>'s <a href=document-sequences.html#nav-document id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-document-2>active
   document</a>.<li>
    <p>If all the following are true:</p>

    <ul><li><p><var>thisTraversable</var> is <a href=#script-closable id=apis-for-creating-and-navigating-browsing-contexts-by-name:script-closable>script-closable</a>;<li><p>the <a href=webappapis.html#concept-incumbent-global id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-incumbent-global>incumbent global object</a>'s <a href=#window-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-bc>browsing context</a> is <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:familiar-with href=document-sequences.html#familiar-with>familiar with</a>
     <var>browsingContext</var>; and<li id=sandboxClose><p>the <a href=webappapis.html#concept-incumbent-global id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-incumbent-global-2>incumbent global
     object</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-6>navigable</a> is <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:allowed-to-navigate href=browsing-the-web.html#allowed-to-navigate>allowed by
     sandboxing to navigate</a> <var>thisTraversable</var>, given
     <var>sourceSnapshotParams</var>,</ul>

    <p>then:</p>

    <ol><li><p>Set <var>thisTraversable</var>'s <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-closing-2 href=document-sequences.html#is-closing>is closing</a> to true.<li><p><a id=apis-for-creating-and-navigating-browsing-contexts-by-name:queue-a-task href=webappapis.html#queue-a-task>Queue a task</a> on the <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-manipulation-task-source href=webappapis.html#dom-manipulation-task-source>DOM manipulation task source</a> to <a href=document-sequences.html#definitely-close-a-top-level-traversable id=apis-for-creating-and-navigating-browsing-contexts-by-name:definitely-close-a-top-level-traversable>definitely close</a>
     <var>thisTraversable</var>.</ol>
   </ol>

  <p>A <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigable href=document-sequences.html#navigable>navigable</a> is <dfn id=script-closable>script-closable</dfn> if it is a <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:top-level-traversable-2 href=document-sequences.html#top-level-traversable>top-level
  traversable</a>, and any of the following are true:</p>

  <ul><li>its <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-created-by-web-content href=document-sequences.html#is-created-by-web-content>is created by web content</a> is true; or<li>its <a href=document-sequences.html#tn-session-history-entries id=apis-for-creating-and-navigating-browsing-contexts-by-name:tn-session-history-entries>session history entries</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=apis-for-creating-and-navigating-browsing-contexts-by-name:list-size data-x-internal=list-size>size</a> is 1.</ul>

  

  <p>The <dfn data-dfn-for=Window id=dom-window-closed data-dfn-type=attribute><code>closed</code></dfn> getter
  steps are to return true if <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-bc id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-bc-2>browsing context</a>
  is null or its <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:is-closing-3 href=document-sequences.html#is-closing>is closing</a> is true; otherwise false.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-stop data-dfn-type=method><code>stop()</code></dfn> method steps
  are:</p>

  <ol><li><p>If <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-7>navigable</a> is null, then
   return.<li><p><a href=document-lifecycle.html#nav-stop id=apis-for-creating-and-navigating-browsing-contexts-by-name:nav-stop>Stop loading</a> <a id=apis-for-creating-and-navigating-browsing-contexts-by-name:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-navigable-8>navigable</a>.</ol>

  


  <h5 id=accessing-other-browsing-contexts><span class=secno>7.2.2.2</span> Indexed access on the <code id=accessing-other-browsing-contexts:window><a href=#window>Window</a></code> object<a href=#accessing-other-browsing-contexts class=self-link></a></h5>

  <dl class=domintro><dt><code><var>window</var>.<a href=#dom-length id=dom-length-dev>length</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/length title="Returns the number of frames (either <frame> or <iframe> elements) in the window.">Window/length</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the number of <a id=accessing-other-browsing-contexts:document-tree-child-navigables href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a>.<dt><code><var>window</var>[<var>index</var>]</code><dd><p>Returns the <code id=accessing-other-browsing-contexts:windowproxy><a href=#windowproxy>WindowProxy</a></code> corresponding to the indicated <a href=document-sequences.html#document-tree-child-navigables id=accessing-other-browsing-contexts:document-tree-child-navigables-2>document-tree child navigables</a>.</dl>

  

  <p>The <dfn data-dfn-for=Window id=dom-length data-dfn-type=attribute><code>length</code></dfn> getter steps are
  to return <a id=accessing-other-browsing-contexts:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-document-window id=accessing-other-browsing-contexts:concept-document-window>associated
  <code>Document</code></a>'s <a id=accessing-other-browsing-contexts:document-tree-child-navigables-3 href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=accessing-other-browsing-contexts:list-size data-x-internal=list-size>size</a>.</p>

  <p class=note>Indexed access to <a id=accessing-other-browsing-contexts:document-tree-child-navigables-4 href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a> is defined through
  the <a href=#windowproxy-getownproperty>[[GetOwnProperty]]</a> internal method of the
  <code id=accessing-other-browsing-contexts:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object.</p>

  


  <h5 id=named-access-on-the-window-object><span class=secno>7.2.2.3</span> Named access on the <code id=named-access-on-the-window-object:window><a href=#window>Window</a></code> object<a href=#named-access-on-the-window-object class=self-link></a></h5>

  <dl class=domintro><dt><code><var>window</var>[<var>name</var>]</code><dd>
    <p>Returns the indicated element or collection of elements.</p>

    <p>As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to
    this API can vary over time, as new features are added to the web platform, for example. Instead
    of this, use <code>document.getElementById()</code> or <code>document.querySelector()</code>.</p>
   </dl>

  

  <p id=child-browsing-context-name-property-set><span id=document-tree-child-browsing-context-name-property-set></span>The <dfn id=document-tree-child-navigable-target-name-property-set>document-tree child
  navigable target name property set</dfn> of a <code id=named-access-on-the-window-object:window-2><a href=#window>Window</a></code> object <var>window</var> is the
  return value of running these steps:</p>

  <ol><li><p>Let <var>children</var> be the <a id=named-access-on-the-window-object:document-tree-child-navigables href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a> of
   <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window>associated
   <code>Document</code></a>.<li><p>Let <var>firstNamedChildren</var> be an empty <a href=https://infra.spec.whatwg.org/#ordered-set id=named-access-on-the-window-object:set data-x-internal=set>ordered
   set</a>.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=named-access-on-the-window-object:list-iterate data-x-internal=list-iterate>For each</a> <var>navigable</var> of <var>children</var>:</p>

    <ol><li><p>Let <var>name</var> be <var>navigable</var>'s <a href=document-sequences.html#nav-target id=named-access-on-the-window-object:nav-target>target name</a>.<li><p>If <var>name</var> is the empty string, then <a id=named-access-on-the-window-object:continue href=https://infra.spec.whatwg.org/#iteration-continue data-x-internal=continue>continue</a>.<li><p>If <var>firstNamedChildren</var> <a href=https://infra.spec.whatwg.org/#list-contain id=named-access-on-the-window-object:list-contains data-x-internal=list-contains>contains</a> a
     <a id=named-access-on-the-window-object:navigable href=document-sequences.html#navigable>navigable</a> whose <a href=document-sequences.html#nav-target id=named-access-on-the-window-object:nav-target-2>target name</a> is <var>name</var>,
     then <a id=named-access-on-the-window-object:continue-2 href=https://infra.spec.whatwg.org/#iteration-continue data-x-internal=continue>continue</a>.<li><p><a href=https://infra.spec.whatwg.org/#list-append id=named-access-on-the-window-object:list-append data-x-internal=list-append>Append</a> <var>navigable</var> to
     <var>firstNamedChildren</var>.</ol>
   <li><p>Let <var>names</var> be an empty <a href=https://infra.spec.whatwg.org/#ordered-set id=named-access-on-the-window-object:set-2 data-x-internal=set>ordered set</a>.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=named-access-on-the-window-object:list-iterate-2 data-x-internal=list-iterate>For each</a> <var>navigable</var> of
    <var>firstNamedChildren</var>:</p>

    <ol><li><p>Let <var>name</var> be <var>navigable</var>'s <a href=document-sequences.html#nav-target id=named-access-on-the-window-object:nav-target-3>target name</a>.<li><p>If <var>navigable</var>'s <a href=document-sequences.html#nav-document id=named-access-on-the-window-object:nav-document>active document</a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=named-access-on-the-window-object:concept-document-origin data-x-internal=concept-document-origin>origin</a> is <a id=named-access-on-the-window-object:same-origin href=browsers.html#same-origin>same origin</a> with
     <var>window</var>'s <a id=named-access-on-the-window-object:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=named-access-on-the-window-object:concept-settings-object-origin>origin</a>, then <a href=https://infra.spec.whatwg.org/#list-append id=named-access-on-the-window-object:list-append-2 data-x-internal=list-append>append</a> <var>name</var> to <var>names</var>.</ol>
   <li><p>Return <var>names</var>.</ol>

  <div class=example>
   <p>The two seperate iterations mean that in the following example, hosted on <code>https://example.org/</code>, assuming <code>https://elsewhere.example/</code>
   sets <code id=named-access-on-the-window-object:dom-name><a href=#dom-name>window.name</a></code> to "<code>spices</code>", evaluating
   <code>window.spices</code> after everything has loaded will yield undefined:</p>

   <pre><code class='html'><c- p>&lt;</c-><c- f>iframe</c-> <c- e>src</c-><c- o>=</c-><c- s>https://elsewhere.example.com/</c-><c- p>&gt;&lt;/</c-><c- f>iframe</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>iframe</c-> <c- e>name</c-><c- o>=</c-><c- s>spices</c-><c- p>&gt;&lt;/</c-><c- f>iframe</c-><c- p>&gt;</c-></code></pre>
  </div>

  <p>The <code id=named-access-on-the-window-object:window-3><a href=#window>Window</a></code> object <a href=https://webidl.spec.whatwg.org/#dfn-support-named-properties id=named-access-on-the-window-object:support-named-properties data-x-internal=support-named-properties>supports named
  properties</a>. The <a id=named-access-on-the-window-object:supported-property-names href=https://webidl.spec.whatwg.org/#dfn-supported-property-names data-x-internal=supported-property-names>supported property names</a> of a <code id=named-access-on-the-window-object:window-4><a href=#window>Window</a></code> object
  <var>window</var> at any moment consist of the following, in <a id=named-access-on-the-window-object:tree-order href=https://dom.spec.whatwg.org/#concept-tree-order data-x-internal=tree-order>tree order</a> according to
  the element that contributed them, ignoring later duplicates:</p>

  
  <ul><li><p><var>window</var>'s <a href=#document-tree-child-navigable-target-name-property-set id=named-access-on-the-window-object:document-tree-child-navigable-target-name-property-set>document-tree child navigable target name property
   set</a>;<li><p>the value of the <code>name</code> content attribute for all <code id=named-access-on-the-window-object:the-embed-element><a href=iframe-embed-object.html#the-embed-element>embed</a></code>,
   <code id=named-access-on-the-window-object:the-form-element><a href=forms.html#the-form-element>form</a></code>, <code id=named-access-on-the-window-object:the-img-element><a href=embedded-content.html#the-img-element>img</a></code>, and <code id=named-access-on-the-window-object:the-object-element><a href=iframe-embed-object.html#the-object-element>object</a></code> elements that
   have a non-empty <code>name</code> content attribute and are <a id=named-access-on-the-window-object:in-a-document-tree href=https://dom.spec.whatwg.org/#in-a-document-tree data-x-internal=in-a-document-tree>in a document
   tree</a> with <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-2>associated
   <code>Document</code></a> as their <a id=named-access-on-the-window-object:root href=https://dom.spec.whatwg.org/#concept-tree-root data-x-internal=root>root</a>; and<li><p>the value of the <code id=named-access-on-the-window-object:the-id-attribute><a href=dom.html#the-id-attribute>id</a></code> content attribute for all <a id=named-access-on-the-window-object:html-elements href=infrastructure.html#html-elements>HTML
   elements</a> that have a non-empty <code id=named-access-on-the-window-object:the-id-attribute-2><a href=dom.html#the-id-attribute>id</a></code> content attribute and are
   <a id=named-access-on-the-window-object:in-a-document-tree-2 href=https://dom.spec.whatwg.org/#in-a-document-tree data-x-internal=in-a-document-tree>in a document tree</a> with <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-3>associated <code>Document</code></a> as their
   <a id=named-access-on-the-window-object:root-2 href=https://dom.spec.whatwg.org/#concept-tree-root data-x-internal=root>root</a>.</ul>

  <p id=dom-window-nameditem>To <a id=named-access-on-the-window-object:determine-the-value-of-a-named-property href=https://webidl.spec.whatwg.org/#dfn-determine-the-value-of-a-named-property data-x-internal=determine-the-value-of-a-named-property>determine the value of a named property</a>
  <var>name</var> in a <code id=named-access-on-the-window-object:window-5><a href=#window>Window</a></code> object <var>window</var>, the user agent must return the
  value obtained using the following steps:</p>

  <ol><li>
    <p>Let <var>objects</var> be the list of <a href=#dom-window-nameditem-filter id=named-access-on-the-window-object:dom-window-nameditem-filter>named
    objects</a> of <var>window</var> with the name <var>name</var>.</p>

    <p class=note>There will be at least one such object, since the algorithm would otherwise not
    have been <a href=https://webidl.spec.whatwg.org/#named-properties-object-getownproperty id=named-access-on-the-window-object:named-properties-object-getownproperty data-x-internal=named-properties-object-getownproperty>invoked by Web IDL</a>.</p>
   <li>
    <p>If <var>objects</var> contains a <a id=named-access-on-the-window-object:navigable-2 href=document-sequences.html#navigable>navigable</a>, then:</p>

    <ol><li><p>Let <var>container</var> be the first <a id=named-access-on-the-window-object:navigable-container href=document-sequences.html#navigable-container>navigable container</a> in
     <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-4>associated
     <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-tree-descendant id=named-access-on-the-window-object:descendant data-x-internal=descendant>descendants</a> whose
     <a id=named-access-on-the-window-object:content-navigable href=document-sequences.html#content-navigable>content navigable</a> is in <var>objects</var>.<li><p>Return <var>container</var>'s <a id=named-access-on-the-window-object:content-navigable-2 href=document-sequences.html#content-navigable>content navigable</a>'s <a href=document-sequences.html#nav-wp id=named-access-on-the-window-object:nav-wp>active <code>WindowProxy</code></a>.</ol>
   <li><p>Otherwise, if <var>objects</var> has only one element, return that element.<li><p>Otherwise, return an <code id=named-access-on-the-window-object:htmlcollection><a data-x-internal=htmlcollection href=https://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection</a></code> rooted at <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-5>associated <code>Document</code></a>, whose filter matches
   only <a href=#dom-window-nameditem-filter id=named-access-on-the-window-object:dom-window-nameditem-filter-2>named objects</a> of <var>window</var> with
   the name <var>name</var>. (By definition, these will all be elements.)</ol>

  <p><dfn id=dom-window-nameditem-filter>Named objects</dfn> of <code id=named-access-on-the-window-object:window-6><a href=#window>Window</a></code> object
  <var>window</var> with the name <var>name</var>, for the purposes of the above algorithm, consist
  of the following:</p>

  
  <ul><li><p><a id=named-access-on-the-window-object:document-tree-child-navigables-2 href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a> of <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-6>associated <code>Document</code></a> whose <a href=document-sequences.html#nav-target id=named-access-on-the-window-object:nav-target-4>target name</a> is <var>name</var>;<li><p><code id=named-access-on-the-window-object:the-embed-element-2><a href=iframe-embed-object.html#the-embed-element>embed</a></code>, <code id=named-access-on-the-window-object:the-form-element-2><a href=forms.html#the-form-element>form</a></code>, <code id=named-access-on-the-window-object:the-img-element-2><a href=embedded-content.html#the-img-element>img</a></code>, or
   <code id=named-access-on-the-window-object:the-object-element-2><a href=iframe-embed-object.html#the-object-element>object</a></code> elements that have a <code>name</code> content attribute whose
   value is <var>name</var> and are <a id=named-access-on-the-window-object:in-a-document-tree-3 href=https://dom.spec.whatwg.org/#in-a-document-tree data-x-internal=in-a-document-tree>in a document tree</a> with <var>window</var>'s <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-7>associated <code>Document</code></a> as their
   <a id=named-access-on-the-window-object:root-3 href=https://dom.spec.whatwg.org/#concept-tree-root data-x-internal=root>root</a>; and<li><p><a id=named-access-on-the-window-object:html-elements-2 href=infrastructure.html#html-elements>HTML elements</a> that have an <code id=named-access-on-the-window-object:the-id-attribute-3><a href=dom.html#the-id-attribute>id</a></code> content attribute
   whose value is <var>name</var> and are <a id=named-access-on-the-window-object:in-a-document-tree-4 href=https://dom.spec.whatwg.org/#in-a-document-tree data-x-internal=in-a-document-tree>in a document tree</a> with <var>window</var>'s
   <a href=#concept-document-window id=named-access-on-the-window-object:concept-document-window-8>associated <code>Document</code></a> as their
   <a id=named-access-on-the-window-object:root-4 href=https://dom.spec.whatwg.org/#concept-tree-root data-x-internal=root>root</a>.</ul>

  <p class=note>Since the <code id=named-access-on-the-window-object:window-7><a href=#window>Window</a></code> interface has the <code id=named-access-on-the-window-object:global><a data-x-internal=global href=https://webidl.spec.whatwg.org/#Global>[Global]</a></code> extended attribute, its named properties follow the rules for
  <a href=https://webidl.spec.whatwg.org/#dfn-named-properties-object id=named-access-on-the-window-object:named-properties-object data-x-internal=named-properties-object>named properties objects</a> rather than <a href=https://webidl.spec.whatwg.org/#dfn-legacy-platform-object id=named-access-on-the-window-object:legacy-platform-object data-x-internal=legacy-platform-object>legacy platform objects</a>.</p>

  


  <h5 id=navigating-nested-browsing-contexts-in-the-dom><span class=secno>7.2.2.4</span> Accessing related windows<a href=#navigating-nested-browsing-contexts-in-the-dom class=self-link></a></h5>

  <dl class=domintro><dt><code><var>window</var>.<a href=#dom-top id=dom-top-dev>top</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/top title="Returns a reference to the topmost window in the window hierarchy.">Window/top</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android yes"><span>Firefox Android</span><span>4+</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy><a href=#windowproxy>WindowProxy</a></code> for the <a id=navigating-nested-browsing-contexts-in-the-dom:top-level-traversable href=document-sequences.html#top-level-traversable>top-level traversable</a>.<dt><code><var>window</var>.<a href=#dom-opener id=dom-opener-dev>opener</a> [ = <var>value</var> ]</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/opener title="The Window interface's opener property returns a reference to the window that opened the window, either with open(), or by navigating a link with a target attribute.">Window/opener</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>9+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> for the <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context href=document-sequences.html#opener-browsing-context>opener browsing context</a>.</p>

    <p>Returns null if there isn't one or if it has been set to null.</p>

    <p>Can be set to null.</p>
   <dt><code><var>window</var>.<a href=#dom-parent id=dom-parent-dev>parent</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/parent title="The Window.parent property is a reference to the parent of the current window or subframe.">Window/parent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1.3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>9+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd><p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> for the <a href=document-sequences.html#nav-parent id=navigating-nested-browsing-contexts-in-the-dom:nav-parent>parent
   navigable</a>.<dt><code><var>window</var>.<a href=#dom-frameelement id=dom-frameelement-dev>frameElement</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/frameElement title="The Window.frameElement property returns the element (such as <iframe> or <object>) in which the window is embedded.">Window/frameElement</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>5.5+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <a id=navigating-nested-browsing-contexts-in-the-dom:navigable-container href=document-sequences.html#navigable-container>navigable container</a> element.</p>

    <p>Returns null if there isn't one, and in cross-origin situations.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=Window id=dom-top data-dfn-type=attribute><code>top</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=navigating-nested-browsing-contexts-in-the-dom:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=navigating-nested-browsing-contexts-in-the-dom:window-navigable>navigable</a> is null, then
   return null.<li><p>Return <a id=navigating-nested-browsing-contexts-in-the-dom:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=navigating-nested-browsing-contexts-in-the-dom:window-navigable-2>navigable</a>'s <a href=document-sequences.html#nav-top id=navigating-nested-browsing-contexts-in-the-dom:nav-top>top-level traversable</a>'s <a href=document-sequences.html#nav-wp id=navigating-nested-browsing-contexts-in-the-dom:nav-wp>active
   <code>WindowProxy</code></a>.</ol>

  <p>The <dfn data-dfn-for=Window id=dom-opener data-dfn-type=attribute><code>opener</code></dfn> getter steps
  are:</p>

  <ol><li><p>Let <var>current</var> be <a id=navigating-nested-browsing-contexts-in-the-dom:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-bc id=navigating-nested-browsing-contexts-in-the-dom:window-bc>browsing
   context</a>.<li><p>If <var>current</var> is null, then return null.<li><p>If <var>current</var>'s <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-2 href=document-sequences.html#opener-browsing-context>opener browsing context</a> is null, then return
   null.<li><p>Return <var>current</var>'s <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-3 href=document-sequences.html#opener-browsing-context>opener browsing context</a>'s
   <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-4><a href=#windowproxy>WindowProxy</a></code> object.</ol>

  <p>The <code id=navigating-nested-browsing-contexts-in-the-dom:dom-opener><a href=#dom-opener>opener</a></code> setter steps are:</p>

  <ol><li><p>If the given value is null and <a id=navigating-nested-browsing-contexts-in-the-dom:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-bc id=navigating-nested-browsing-contexts-in-the-dom:window-bc-2>browsing
   context</a> is non-null, then set <a id=navigating-nested-browsing-contexts-in-the-dom:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-bc id=navigating-nested-browsing-contexts-in-the-dom:window-bc-3>browsing
   context</a>'s <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-4 href=document-sequences.html#opener-browsing-context>opener browsing context</a> to null.<li><p>If the given value is non-null, then perform ?
   <a id=navigating-nested-browsing-contexts-in-the-dom:definepropertyorthrow href=https://tc39.es/ecma262/#sec-definepropertyorthrow data-x-internal=definepropertyorthrow>DefinePropertyOrThrow</a>(<a id=navigating-nested-browsing-contexts-in-the-dom:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, "<code>opener</code>", {
   [[Value]]: the given value, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true
   }).</ol>

  <div class=note>
   <p>Setting <code id=navigating-nested-browsing-contexts-in-the-dom:dom-opener-2><a href=#dom-opener>window.opener</a></code> to null clears the <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-5 href=document-sequences.html#opener-browsing-context>opener
   browsing context</a> reference. In practice, this prevents future scripts from accessing their
   <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-6 href=document-sequences.html#opener-browsing-context>opener browsing context</a>'s <code id=navigating-nested-browsing-contexts-in-the-dom:window><a href=#window>Window</a></code> object.</p>

   <p>By default, scripts can access their <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-7 href=document-sequences.html#opener-browsing-context>opener browsing context</a>'s
   <code id=navigating-nested-browsing-contexts-in-the-dom:window-2><a href=#window>Window</a></code> object through the <code id=navigating-nested-browsing-contexts-in-the-dom:dom-opener-3><a href=#dom-opener>window.opener</a></code> getter.
   E.g., a script can set <code>window.opener.location</code>, causing the <a id=navigating-nested-browsing-contexts-in-the-dom:opener-browsing-context-8 href=document-sequences.html#opener-browsing-context>opener
   browsing context</a> to navigate.</p>
  </div>

  <p>The <dfn data-dfn-for=Window id=dom-parent data-dfn-type=attribute><code>parent</code></dfn> getter steps
  are:</p>

  <ol><li><p>Let <var>navigable</var> be <a id=navigating-nested-browsing-contexts-in-the-dom:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigable id=navigating-nested-browsing-contexts-in-the-dom:window-navigable-3>navigable</a>.<li><p>If <var>navigable</var> is null, then return null.<li><p>If <var>navigable</var>'s <a href=document-sequences.html#nav-parent id=navigating-nested-browsing-contexts-in-the-dom:nav-parent-2>parent</a> is not null, then set
   <var>navigable</var> to <var>navigable</var>'s <a href=document-sequences.html#nav-parent id=navigating-nested-browsing-contexts-in-the-dom:nav-parent-3>parent</a>.<li><p>Return <var>navigable</var>'s <a href=document-sequences.html#nav-wp id=navigating-nested-browsing-contexts-in-the-dom:nav-wp-2>active
   <code>WindowProxy</code></a>.</ol>

  <p>The <dfn data-dfn-for=Window id=dom-frameelement data-dfn-type=attribute><code>frameElement</code></dfn>
  getter steps are:</p>

  <ol><li><p>Let <var>current</var> be <a id=navigating-nested-browsing-contexts-in-the-dom:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=navigating-nested-browsing-contexts-in-the-dom:node-navigable href=document-sequences.html#node-navigable>node navigable</a>.<li><p>If <var>current</var> is null, then return null.<li><p>Let <var>container</var> be <var>current</var>'s <a href=document-sequences.html#nav-container id=navigating-nested-browsing-contexts-in-the-dom:nav-container>container</a>.<li><p>If <var>container</var> is null, then return null.<li><p>If <var>container</var>'s <a id=navigating-nested-browsing-contexts-in-the-dom:node-document href=https://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=navigating-nested-browsing-contexts-in-the-dom:concept-document-origin data-x-internal=concept-document-origin>origin</a> is not <a id=navigating-nested-browsing-contexts-in-the-dom:same-origin-domain href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=navigating-nested-browsing-contexts-in-the-dom:current-settings-object href=webappapis.html#current-settings-object>current settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=navigating-nested-browsing-contexts-in-the-dom:concept-settings-object-origin>origin</a>, then return null.<li><p>Return <var>container</var>.</ol>

  <div class=example>
   <p>An example of when these properties can return null is as follows:</p>

   <pre><code class='html'><c- cp>&lt;!DOCTYPE html&gt;</c->
<c- p>&lt;</c-><c- f>iframe</c-><c- p>&gt;&lt;/</c-><c- f>iframe</c-><c- p>&gt;</c->

<c- p>&lt;</c-><c- f>script</c-><c- p>&gt;</c->
<c- u>&quot;use strict&quot;</c-><c- p>;</c->
<c- a>const</c-> element <c- o>=</c-> document<c- p>.</c->querySelector<c- p>(</c-><c- u>&quot;iframe&quot;</c-><c- p>);</c->
<c- a>const</c-> iframeWindow <c- o>=</c-> element<c- p>.</c->contentWindow<c- p>;</c->
element<c- p>.</c->remove<c- p>();</c->

console<c- p>.</c->assert<c- p>(</c->iframeWindow<c- p>.</c->top <c- o>===</c-> <c- kc>null</c-><c- p>);</c->
console<c- p>.</c->assert<c- p>(</c->iframeWindow<c- p>.</c->parent <c- o>===</c-> <c- kc>null</c-><c- p>);</c->
console<c- p>.</c->assert<c- p>(</c->iframeWindow<c- p>.</c->frameElement <c- o>===</c-> <c- kc>null</c-><c- p>);</c->
<c- p>&lt;/</c-><c- f>script</c-><c- p>&gt;</c-></code></pre>

   <p>Here the <a id=navigating-nested-browsing-contexts-in-the-dom:browsing-context href=document-sequences.html#browsing-context>browsing context</a> corresponding to <code>iframeWindow</code>
   was <a href=document-lifecycle.html#destroy-a-document id=navigating-nested-browsing-contexts-in-the-dom:destroy-a-document>nulled out</a> when <code>element</code> was
   removed from the document.</p>
  </div>

  


  <h5 id=browser-interface-elements><span class=secno>7.2.2.5</span> Historical browser interface element APIs<a href=#browser-interface-elements class=self-link></a></h5>

  <p>For historical reasons, the <code id=browser-interface-elements:window><a href=#window>Window</a></code> interface had some properties that represented
  the visibility of certain web browser interface elements.</p>

  <p>For privacy and interoperability reasons, those properties now return values that
  represent whether the <code id=browser-interface-elements:window-2><a href=#window>Window</a></code>'s <a href=#window-bc id=browser-interface-elements:window-bc>browsing context</a>'s
  <a id=browser-interface-elements:is-popup href=document-sequences.html#is-popup>is popup</a> property is true or false.</p>

  

  <p>Each interface element is represented by a <code id=browser-interface-elements:barprop><a href=#barprop>BarProp</a></code> object:</p>

  <div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/BarProp title="The BarProp interface of the Document Object Model represents the web browser user interface elements that are exposed to scripts in web pages. Each of the following interface elements are represented by a BarProp object.">BarProp</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='barprop' data-dfn-type='interface'><c- g>BarProp</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-barprop-visible' id='browser-interface-elements:dom-barprop-visible'><c- g>visible</c-></a>;
};</code></pre>

  <dl class=domintro><dt><code><var>window</var>.<a href=#dom-window-locationbar id=dom-window-locationbar-dev>locationbar</a>.<a href=#dom-barprop-visible id=dom-barprop-visible-dev>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/locationbar title="Returns the locationbar object.">Window/locationbar</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-window-menubar id=dom-window-menubar-dev>menubar</a>.<a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible-2>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/menubar title="Returns the menubar object.">Window/menubar</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-window-personalbar id=dom-window-personalbar-dev>personalbar</a>.<a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible-3>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/personalbar title="Returns the personalbar object.">Window/personalbar</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-window-scrollbars id=dom-window-scrollbars-dev>scrollbars</a>.<a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible-4>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollbars title="Returns the scrollbars object.">Window/scrollbars</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-window-statusbar id=dom-window-statusbar-dev>statusbar</a>.<a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible-5>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/statusbar title="Returns the statusbar object.">Window/statusbar</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dt><code><var>window</var>.<a href=#dom-window-toolbar id=dom-window-toolbar-dev>toolbar</a>.<a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible-6>visible</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/toolbar title="Returns the toolbar object.">Window/toolbar</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd><p>Returns true if the <code id=browser-interface-elements:window-3><a href=#window>Window</a></code> is not a popup; otherwise, returns false.</dl>

  

  <div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/BarProp/visible title="The visible read-only property of the BarProp interface returns true if the user interface element it represents is visible.">BarProp/visible</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><p>The <dfn data-dfn-for=BarProp id=dom-barprop-visible data-dfn-type=attribute><code>visible</code></dfn> getter
  steps are:</p>

  <ol><li><p>Let <var>browsingContext</var> be <a id=browser-interface-elements:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=browser-interface-elements:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global
   object</a>'s <a href=#window-bc id=browser-interface-elements:window-bc-2>browsing context</a>.<li><p>If <var>browsingContext</var> is null, then return true.<li><p>Return the negation of <var>browsingContext</var>'s <a href=document-sequences.html#bc-tlbc id=browser-interface-elements:bc-tlbc>top-level
   browsing context</a>'s <a id=browser-interface-elements:is-popup-2 href=document-sequences.html#is-popup>is popup</a>.</ol>

  <p>The following <code id=browser-interface-elements:barprop-2><a href=#barprop>BarProp</a></code> objects must exist for each <code id=browser-interface-elements:window-4><a href=#window>Window</a></code> object:</p>

  <dl><dt><dfn id=the-location-bar-barprop-object>The location bar <code>BarProp</code> object</dfn><dd>Historically represented the user interface element that contains a control that displays the
   browser's location bar.<dt><dfn id=the-menu-bar-barprop-object>The menu bar <code>BarProp</code> object</dfn><dd>Historically represented the user interface element that contains a list of commands in menu
   form, or some similar interface concept.<dt><dfn id=the-personal-bar-barprop-object>The personal bar <code>BarProp</code> object</dfn><dd>Historically represented the user interface element that contains links to the user's
   favorite pages, or some similar interface concept.<dt><dfn id=the-scrollbar-barprop-object>The scrollbar <code>BarProp</code> object</dfn><dd>Historically represented the user interface element that contains a scrolling mechanism, or
   some similar interface concept.<dt><dfn id=the-status-bar-barprop-object>The status bar <code>BarProp</code> object</dfn><dd>Historically represented a user interface element found immediately below or after the
   document, as appropriate for the user's media, which typically provides information about ongoing
   network activity or information about elements that the user's pointing device is currently
   indicating.<dt><dfn id=the-toolbar-barprop-object>The toolbar <code>BarProp</code> object</dfn><dd>Historically represented the user interface element found immediately above or before the
   document, as appropriate for the user's media, which typically provides <a href=browsing-the-web.html#apply-the-traverse-history-step id=browser-interface-elements:apply-the-traverse-history-step>session history traversal</a> controls (back and forward buttons,
   reload buttons, etc.).</dl>

  <p>The <dfn data-dfn-for=Window id=dom-window-locationbar data-dfn-type=attribute><code>locationbar</code></dfn>
  attribute must return <a href=#the-location-bar-barprop-object id=browser-interface-elements:the-location-bar-barprop-object>the location bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-menubar data-dfn-type=attribute><code>menubar</code></dfn>
  attribute must return <a href=#the-menu-bar-barprop-object id=browser-interface-elements:the-menu-bar-barprop-object>the menu bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-personalbar data-dfn-type=attribute><code>personalbar</code></dfn>
  attribute must return <a href=#the-personal-bar-barprop-object id=browser-interface-elements:the-personal-bar-barprop-object>the personal bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-scrollbars data-dfn-type=attribute><code>scrollbars</code></dfn>
  attribute must return <a href=#the-scrollbar-barprop-object id=browser-interface-elements:the-scrollbar-barprop-object>the scrollbar <code>BarProp</code> object</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-statusbar data-dfn-type=attribute><code>statusbar</code></dfn>
  attribute must return <a href=#the-status-bar-barprop-object id=browser-interface-elements:the-status-bar-barprop-object>the status bar <code>BarProp</code> object</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-window-toolbar data-dfn-type=attribute><code>toolbar</code></dfn>
  attribute must return <a href=#the-toolbar-barprop-object id=browser-interface-elements:the-toolbar-barprop-object>the toolbar <code>BarProp</code> object</a>.</p>

  <hr>

  <p>For historical reasons, the <dfn data-dfn-for=Window id=dom-window-status data-dfn-type=attribute><code>status</code></dfn> attribute on the <code id=browser-interface-elements:window-5><a href=#window>Window</a></code> object must,
  on getting, return the last string it was set to, and on setting, must set itself to the new
  value. When the <code id=browser-interface-elements:window-6><a href=#window>Window</a></code> object is created, the attribute must be set to the empty
  string. It does not do anything else.</p>


  <h5 id=script-settings-for-window-objects><span class=secno>7.2.2.6</span> Script settings for <code id=script-settings-for-window-objects:window><a href=#window>Window</a></code> objects<a href=#script-settings-for-window-objects class=self-link></a></h5>

  <p>To <dfn id=set-up-a-window-environment-settings-object>set up a window environment settings object</dfn>, given a <a id=script-settings-for-window-objects:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a>
  <var>creationURL</var>, a <a id=script-settings-for-window-objects:javascript-execution-context href=https://tc39.es/ecma262/#sec-execution-contexts data-x-internal=javascript-execution-context>JavaScript execution context</a> <var>execution context</var>,
  null or an <a id=script-settings-for-window-objects:environment href=webappapis.html#environment>environment</a> <var>reservedEnvironment</var>, a <a id=script-settings-for-window-objects:url-2 href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a>
  <var>topLevelCreationURL</var>, and an <a id=script-settings-for-window-objects:concept-origin href=browsers.html#concept-origin>origin</a> <var>topLevelOrigin</var>, run these
  steps:</p>

  <ol><li><p>Let <var>realm</var> be the value of <var>execution context</var>'s Realm
   component.<li><p>Let <var>window</var> be <var>realm</var>'s <a href=webappapis.html#concept-realm-global id=script-settings-for-window-objects:concept-realm-global>global
   object</a>.<li>
    <p>Let <var>settings object</var> be a new <a id=script-settings-for-window-objects:environment-settings-object href=webappapis.html#environment-settings-object>environment settings object</a> whose
    algorithms are defined as follows:</p>

    <dl><dt>The <a id=script-settings-for-window-objects:realm-execution-context href=webappapis.html#realm-execution-context>realm execution context</a><dd>
      <p>Return <var>execution context</var>.</p>
     <dt>The <a href=webappapis.html#concept-settings-object-module-map id=script-settings-for-window-objects:concept-settings-object-module-map>module map</a><dd>
      <p>Return the <a href=dom.html#concept-document-module-map id=script-settings-for-window-objects:concept-document-module-map>module map</a> of
      <var>window</var>'s <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window>associated
      <code>Document</code></a>.</p>
     <dt>The <a id=script-settings-for-window-objects:api-base-url href=webappapis.html#api-base-url>API base URL</a><dd>
      <p>Return the current <a href=urls-and-fetching.html#document-base-url id=script-settings-for-window-objects:document-base-url>base URL</a> of <var>window</var>'s
      <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-2>associated <code>Document</code></a>.</p>
     <dt>The <a href=webappapis.html#concept-settings-object-origin id=script-settings-for-window-objects:concept-settings-object-origin>origin</a><dd>
      <p>Return the <a href=https://dom.spec.whatwg.org/#concept-document-origin id=script-settings-for-window-objects:concept-document-origin data-x-internal=concept-document-origin>origin</a> of <var>window</var>'s
      <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-3>associated <code>Document</code></a>.</p>
     <dt>The <a href=webappapis.html#concept-settings-object-has-cross-site-ancestor id=script-settings-for-window-objects:concept-settings-object-has-cross-site-ancestor>has cross-site
     ancestor</a><dd>
      <ol><li><p>If <var>window</var>'s <a id=script-settings-for-window-objects:navigable href=document-sequences.html#navigable>navigable</a>'s <a href=document-sequences.html#nav-parent id=script-settings-for-window-objects:nav-parent>parent</a> is null, then return false.<li><p>Let <var>parentDocument</var> be <var>window</var>'s <a id=script-settings-for-window-objects:navigable-2 href=document-sequences.html#navigable>navigable</a>'s <a href=document-sequences.html#nav-parent id=script-settings-for-window-objects:nav-parent-2>parent</a>'s <a href=document-sequences.html#nav-document id=script-settings-for-window-objects:nav-document>active
       document</a>.<li><p>If <var>parentDocument</var>'s <a id=script-settings-for-window-objects:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings object</a>'s <a href=webappapis.html#concept-settings-object-has-cross-site-ancestor id=script-settings-for-window-objects:concept-settings-object-has-cross-site-ancestor-2>has cross-site ancestor</a> is
       true, then return true.<li><p>If <var>parentDocument</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=script-settings-for-window-objects:concept-document-origin-2 data-x-internal=concept-document-origin>origin</a>
       is not <a id=script-settings-for-window-objects:same-site href=browsers.html#same-site>same site</a> with <var>window</var>'s <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-4>associated <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=script-settings-for-window-objects:concept-document-origin-3 data-x-internal=concept-document-origin>origin</a>, then return true.<li><p>Return false.</ol>
     <dt>The <a href=webappapis.html#concept-settings-object-policy-container id=script-settings-for-window-objects:concept-settings-object-policy-container>policy container</a><dd>
      <p>Return the <a href=dom.html#concept-document-policy-container id=script-settings-for-window-objects:concept-document-policy-container>policy container</a> of
      <var>window</var>'s <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-5>associated
      <code>Document</code></a>.</p>
     <dt>The <a href=webappapis.html#concept-settings-object-cross-origin-isolated-capability id=script-settings-for-window-objects:concept-settings-object-cross-origin-isolated-capability>cross-origin
     isolated capability</a><dd>
      <p>Return true if both of the following hold, and false otherwise:</p>
      <ul><li><p><var>realm</var>'s <a id=script-settings-for-window-objects:agent-cluster href=https://tc39.es/ecma262/#sec-agent-clusters data-x-internal=agent-cluster>agent cluster</a>'s <a href=webappapis.html#agent-cluster-cross-origin-isolation id=script-settings-for-window-objects:agent-cluster-cross-origin-isolation>cross-origin-isolation mode</a> is "<code id=script-settings-for-window-objects:cross-origin-isolation-concrete><a href=document-sequences.html#cross-origin-isolation-concrete>concrete</a></code>", and<li><p><var>window</var>'s <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-6>associated
       <code>Document</code></a> is <a id=script-settings-for-window-objects:allowed-to-use href=iframe-embed-object.html#allowed-to-use>allowed to use</a> the "<code id=script-settings-for-window-objects:cross-origin-isolated-feature><a href=infrastructure.html#cross-origin-isolated-feature>cross-origin-isolated</a></code>" feature.</ul>
     <dt>The <a href=webappapis.html#concept-settings-object-time-origin id=script-settings-for-window-objects:concept-settings-object-time-origin>time origin</a><dd>
      <p>Return <var>window</var>'s <a href=#concept-document-window id=script-settings-for-window-objects:concept-document-window-7>associated
      <code>Document</code></a>'s <a id=script-settings-for-window-objects:load-timing-info href=dom.html#load-timing-info>load timing info</a>'s <a id=script-settings-for-window-objects:navigation-start-time href=dom.html#navigation-start-time>navigation start
      time</a>.</p>
     </dl>
   <li>
    <p>If <var>reservedEnvironment</var> is non-null, then:</p>

    <ol><li><p>Set <var>settings object</var>'s <a href=webappapis.html#concept-environment-id id=script-settings-for-window-objects:concept-environment-id>id</a> to
     <var>reservedEnvironment</var>'s <a href=webappapis.html#concept-environment-id id=script-settings-for-window-objects:concept-environment-id-2>id</a>, <a href=webappapis.html#concept-environment-target-browsing-context id=script-settings-for-window-objects:concept-environment-target-browsing-context>target browsing context</a> to
     <var>reservedEnvironment</var>'s <a href=webappapis.html#concept-environment-target-browsing-context id=script-settings-for-window-objects:concept-environment-target-browsing-context-2>target browsing context</a>, and <a href=webappapis.html#concept-environment-active-service-worker id=script-settings-for-window-objects:concept-environment-active-service-worker>active service worker</a> to
     <var>reservedEnvironment</var>'s <a href=webappapis.html#concept-environment-active-service-worker id=script-settings-for-window-objects:concept-environment-active-service-worker-2>active service worker</a>.<li>
      <p>Set <var>reservedEnvironment</var>'s <a href=webappapis.html#concept-environment-id id=script-settings-for-window-objects:concept-environment-id-3>id</a> to
      the empty string.</p>

      <p class=note>The identity of the reserved environment is considered to be fully
      transferred to the created <a id=script-settings-for-window-objects:environment-settings-object-2 href=webappapis.html#environment-settings-object>environment settings object</a>. The reserved environment
      is not searchable by the <a id=script-settings-for-window-objects:environment-2 href=webappapis.html#environment>environment</a>’s <a href=webappapis.html#concept-environment-id id=script-settings-for-window-objects:concept-environment-id-4>id</a> from this point on.</p>
     </ol>
   <li><p>Otherwise, set <var>settings object</var>'s <a href=webappapis.html#concept-environment-id id=script-settings-for-window-objects:concept-environment-id-5>id</a> to a new unique opaque string, <var>settings
   object</var>'s <a href=webappapis.html#concept-environment-target-browsing-context id=script-settings-for-window-objects:concept-environment-target-browsing-context-3>target browsing
   context</a> to null, and <var>settings object</var>'s <a href=webappapis.html#concept-environment-active-service-worker id=script-settings-for-window-objects:concept-environment-active-service-worker-3>active service worker</a> to null.<li><p>Set <var>settings object</var>'s <a href=webappapis.html#concept-environment-creation-url id=script-settings-for-window-objects:concept-environment-creation-url>creation
   URL</a> to <var>creationURL</var>, <var>settings object</var>'s <a id=script-settings-for-window-objects:concept-environment-top-level-creation-url href=webappapis.html#concept-environment-top-level-creation-url>top-level creation
   URL</a> to <var>topLevelCreationURL</var>, and <var>settings object</var>'s <a id=script-settings-for-window-objects:concept-environment-top-level-origin href=webappapis.html#concept-environment-top-level-origin>top-level
   origin</a> to <var>topLevelOrigin</var>.<li><p>Set <var>realm</var>'s [[HostDefined]] field to <var>settings object</var>.</ol>

  


  <h4 id=the-windowproxy-exotic-object><span class=secno>7.2.3</span> The <code id=the-windowproxy-exotic-object:windowproxy><a href=#windowproxy>WindowProxy</a></code> exotic object<a href=#the-windowproxy-exotic-object class=self-link></a></h4>

  <p>A <dfn id=windowproxy data-dfn-type=interface><code>WindowProxy</code></dfn> is an exotic object that wraps a
  <code id=the-windowproxy-exotic-object:window><a href=#window>Window</a></code> ordinary object, indirecting most operations through to the wrapped object.
  Each <a id=the-windowproxy-exotic-object:browsing-context href=document-sequences.html#browsing-context>browsing context</a> has an associated <code id=the-windowproxy-exotic-object:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object. When the
  <a id=the-windowproxy-exotic-object:browsing-context-2 href=document-sequences.html#browsing-context>browsing context</a> is <a href=browsing-the-web.html#navigate id=the-windowproxy-exotic-object:navigate>navigated</a>, the <code id=the-windowproxy-exotic-object:window-2><a href=#window>Window</a></code>
  object wrapped by the <a id=the-windowproxy-exotic-object:browsing-context-3 href=document-sequences.html#browsing-context>browsing context</a>'s associated <code id=the-windowproxy-exotic-object:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object
  is changed.</p>

  

  <p>The <code id=the-windowproxy-exotic-object:windowproxy-4><a href=#windowproxy>WindowProxy</a></code> exotic object must use the ordinary internal methods except where
  it is explicitly specified otherwise below.</p>

  <p>There is no <code id=the-windowproxy-exotic-object:windowproxy-5><a href=#windowproxy>WindowProxy</a></code> <a id=the-windowproxy-exotic-object:interface-object href=https://webidl.spec.whatwg.org/#dfn-interface-object data-x-internal=interface-object>interface object</a>.</p>

  <p>Every <code id=the-windowproxy-exotic-object:windowproxy-6><a href=#windowproxy>WindowProxy</a></code> object has a <dfn id=concept-windowproxy-window data-export="">[[Window]]</dfn> internal slot representing the wrapped <code id=the-windowproxy-exotic-object:window-3><a href=#window>Window</a></code> object.</p>

  <p class=note>Although <code id=the-windowproxy-exotic-object:windowproxy-7><a href=#windowproxy>WindowProxy</a></code> is named as a "proxy", it does not do
  polymorphic dispatch on its target's internal methods as a real proxy would, due to a desire to
  reuse machinery between <code id=the-windowproxy-exotic-object:windowproxy-8><a href=#windowproxy>WindowProxy</a></code> and <code id=the-windowproxy-exotic-object:location><a href=#location>Location</a></code> objects. As long as the
  <code id=the-windowproxy-exotic-object:window-4><a href=#window>Window</a></code> object remains an ordinary object this is unobservable and can be implemented
  either way.</p>

  <h5 id=windowproxy-getprototypeof><span class=secno>7.2.3.1</span> [[GetPrototypeOf]] ( )<a href=#windowproxy-getprototypeof class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-getprototypeof:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-getprototypeof:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then return !
   <a id=windowproxy-getprototypeof:ordinarygetprototypeof href=https://tc39.es/ecma262/#sec-ordinarygetprototypeof data-x-internal=ordinarygetprototypeof>OrdinaryGetPrototypeOf</a>(<var>W</var>).<li><p>Return null.</ol>

  <h5 id=windowproxy-setprototypeof><span class=secno>7.2.3.2</span> [[SetPrototypeOf]] ( <var>V</var> )<a href=#windowproxy-setprototypeof class=self-link></a></h5>

  <ol><li><p>Return ! <a id=windowproxy-setprototypeof:setimmutableprototype href=https://tc39.es/ecma262/#sec-set-immutable-prototype data-x-internal=setimmutableprototype>SetImmutablePrototype</a>(<b>this</b>, <var>V</var>).</ol>

  <h5 id=windowproxy-isextensible><span class=secno>7.2.3.3</span> [[IsExtensible]] ( )<a href=#windowproxy-isextensible class=self-link></a></h5>

  <ol><li><p>Return true.</ol>

  <h5 id=windowproxy-preventextensions><span class=secno>7.2.3.4</span> [[PreventExtensions]] ( )<a href=#windowproxy-preventextensions class=self-link></a></h5>

  <ol><li><p>Return false.</ol>

  <h5 id=windowproxy-getownproperty><span class=secno>7.2.3.5</span> [[GetOwnProperty]] ( <var>P</var> )<a href=#windowproxy-getownproperty class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-getownproperty:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li>
    <p>If <var>P</var> is an <a id=windowproxy-getownproperty:array-index-property-name href=https://webidl.spec.whatwg.org/#dfn-array-index-property-name data-x-internal=array-index-property-name>array index property name</a>, then:</p>

    <ol><li><p>Let <var>index</var> be ! <a id=windowproxy-getownproperty:touint32 href=https://tc39.es/ecma262/#sec-touint32 data-x-internal=touint32>ToUint32</a>(<var>P</var>).<li><p>Let <var>children</var> be the <a id=windowproxy-getownproperty:document-tree-child-navigables href=document-sequences.html#document-tree-child-navigables>document-tree child navigables</a> of
     <var>W</var>'s <a href=#concept-document-window id=windowproxy-getownproperty:concept-document-window>associated
     <code>Document</code></a>.<li><p>Let <var>value</var> be undefined.<li>
      <p>If <var>index</var> is less than <var>children</var>'s <a href=https://infra.spec.whatwg.org/#list-size id=windowproxy-getownproperty:list-size data-x-internal=list-size>size</a>, then:</p>

      <ol><li><p><a href=https://infra.spec.whatwg.org/#list-sort-in-ascending-order id=windowproxy-getownproperty:list-sort data-x-internal=list-sort>Sort</a> <var>children</var> in ascending order, with
       <var>navigableA</var> being less than <var>navigableB</var> if <var>navigableA</var>'s <a href=document-sequences.html#nav-container id=windowproxy-getownproperty:nav-container>container</a> was inserted into <var>W</var>'s <a href=#concept-document-window id=windowproxy-getownproperty:concept-document-window-2>associated <code>Document</code></a> earlier than
       <var>navigableB</var>'s <a href=document-sequences.html#nav-container id=windowproxy-getownproperty:nav-container-2>container</a> was.<li><p>Set <var>value</var> to <var>children</var>[<var>index</var>]'s <a href=document-sequences.html#nav-wp id=windowproxy-getownproperty:nav-wp>active <code>WindowProxy</code></a>.</ol>
     <li>
      <p>If <var>value</var> is undefined, then:</p>

      <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-getownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then return
       undefined.<li><p>Throw a <a id=windowproxy-getownproperty:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=windowproxy-getownproperty:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>
     <li><p>Return <a id=windowproxy-getownproperty:propertydescriptor href=https://tc39.es/ecma262/#sec-property-descriptor-specification-type data-x-internal=propertydescriptor>PropertyDescriptor</a> {
     [[Value]]: <var>value</var>,
     [[Writable]]: false,
     [[Enumerable]]: true,
     [[Configurable]]: true }.</ol>
   <li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-getownproperty:isplatformobjectsameorigin-(-o-)-2>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then return !
    <a id=windowproxy-getownproperty:ordinarygetownproperty href=https://tc39.es/ecma262/#sec-ordinarygetownproperty data-x-internal=ordinarygetownproperty>OrdinaryGetOwnProperty</a>(<var>W</var>, <var>P</var>).</p>

    <p class=note>This is a <a id=windowproxy-getownproperty:willful-violation href=https://infra.spec.whatwg.org/#willful-violation data-x-internal=willful-violation>willful violation</a> of the JavaScript specification's
    <a id=windowproxy-getownproperty:invariants-of-the-essential-internal-methods href=https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internal=invariants-of-the-essential-internal-methods>invariants of the essential internal methods</a> to maintain compatibility with
    existing web content. See <a href=https://github.com/tc39/ecma262/issues/672>tc39/ecma262
    issue #672</a> for more information. <a href=references.html#refsJAVASCRIPT>[JAVASCRIPT]</a></p>
   <li><p>Let <var>property</var> be <a href=#crossorigingetownpropertyhelper-(-o,-p-) id=windowproxy-getownproperty:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper</a>(<var>W</var>,
   <var>P</var>).<li><p>If <var>property</var> is not undefined, then return <var>property</var>.<li>
    <p>If <var>property</var> is undefined and <var>P</var> is in <var>W</var>'s <a href=#document-tree-child-navigable-target-name-property-set id=windowproxy-getownproperty:document-tree-child-navigable-target-name-property-set>document-tree
    child navigable target name property set</a>, then:</p>

    <ol><li><p>Let <var>value</var> be the <a href=document-sequences.html#nav-wp id=windowproxy-getownproperty:nav-wp-2>active
     <code>WindowProxy</code></a> of the <a href=#dom-window-nameditem-filter id=windowproxy-getownproperty:dom-window-nameditem-filter>named
     object</a> of <var>W</var> with the name <var>P</var>.<li>
      <p>Return <a id=windowproxy-getownproperty:propertydescriptor-2 href=https://tc39.es/ecma262/#sec-property-descriptor-specification-type data-x-internal=propertydescriptor>PropertyDescriptor</a> {
      [[Value]]: <var>value</var>,
      [[Enumerable]]: false,
      [[Writable]]: false,
      [[Configurable]]: true }.</p>

      <p class=note>The reason the property descriptors are non-enumerable, despite this
      mismatching the same-origin behavior, is for compatibility with existing web content. See <a href=https://github.com/whatwg/html/issues/3183>issue #3183</a> for details.</p>
     </ol>

   <li><p>Return ? <a href=#crossoriginpropertyfallback-(-p-) id=windowproxy-getownproperty:crossoriginpropertyfallback-(-p-)>CrossOriginPropertyFallback</a>(<var>P</var>).</ol>

  <h5 id=windowproxy-defineownproperty><span class=secno>7.2.3.6</span> [[DefineOwnProperty]] ( <var>P</var>, <var>Desc</var>
  )<a href=#windowproxy-defineownproperty class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-defineownproperty:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-defineownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then:

    <ol><li><p>If <var>P</var> is an <a id=windowproxy-defineownproperty:array-index-property-name href=https://webidl.spec.whatwg.org/#dfn-array-index-property-name data-x-internal=array-index-property-name>array index property name</a>, return false.<li>
      <p>Return ? <a id=windowproxy-defineownproperty:ordinarydefineownproperty href=https://tc39.es/ecma262/#sec-ordinarydefineownproperty data-x-internal=ordinarydefineownproperty>OrdinaryDefineOwnProperty</a>(<var>W</var>, <var>P</var>,
      <var>Desc</var>).</p>

      <p class=note>This is a <a id=windowproxy-defineownproperty:willful-violation href=https://infra.spec.whatwg.org/#willful-violation data-x-internal=willful-violation>willful violation</a> of the JavaScript specification's
      <a id=windowproxy-defineownproperty:invariants-of-the-essential-internal-methods href=https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internal=invariants-of-the-essential-internal-methods>invariants of the essential internal methods</a> to maintain compatibility with
      existing web content. See <a href=https://github.com/tc39/ecma262/issues/672>tc39/ecma262
      issue #672</a> for more information. <a href=references.html#refsJAVASCRIPT>[JAVASCRIPT]</a></p>
     </ol>

   <li><p>Throw a <a id=windowproxy-defineownproperty:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=windowproxy-defineownproperty:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h5 id=windowproxy-get><span class=secno>7.2.3.7</span> [[Get]] ( <var>P</var>, <var>Receiver</var> )<a href=#windowproxy-get class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-get:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li><p><a href=browsers.html#coop-check-access-report id=windowproxy-get:coop-check-access-report>Check if an access between two browsing contexts
   should be reported</a>, given the <a id=windowproxy-get:current-global-object href=webappapis.html#current-global-object>current global object</a>'s
   <a href=#window-bc id=windowproxy-get:window-bc>browsing context</a>, <var>W</var>'s <a href=#window-bc id=windowproxy-get:window-bc-2>browsing context</a>, <var>P</var>, and the <a id=windowproxy-get:current-settings-object href=webappapis.html#current-settings-object>current settings
   object</a>.<li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-get:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then return ?
   <a id=windowproxy-get:ordinaryget href=https://tc39.es/ecma262/#sec-ordinaryget data-x-internal=ordinaryget>OrdinaryGet</a>(<b>this</b>, <var>P</var>, <var>Receiver</var>).<li><p>Return ? <a href=#crossoriginget-(-o,-p,-receiver-) id=windowproxy-get:crossoriginget-(-o,-p,-receiver-)>CrossOriginGet</a>(<b>this</b>, <var>P</var>,
   <var>Receiver</var>).</ol>

  <p class=note><b>this</b> is passed rather than <var>W</var> as <a id=windowproxy-get:ordinaryget-2 href=https://tc39.es/ecma262/#sec-ordinaryget data-x-internal=ordinaryget>OrdinaryGet</a> and
  <a href=#crossoriginget-(-o,-p,-receiver-) id=windowproxy-get:crossoriginget-(-o,-p,-receiver-)-2>CrossOriginGet</a> will invoke the <a href=#windowproxy-getownproperty>[[GetOwnProperty]]</a> internal method.</p>

  <h5 id=windowproxy-set><span class=secno>7.2.3.8</span> [[Set]] ( <var>P</var>, <var>V</var>, <var>Receiver</var> )<a href=#windowproxy-set class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-set:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li><p><a href=browsers.html#coop-check-access-report id=windowproxy-set:coop-check-access-report>Check if an access between two browsing contexts
   should be reported</a>, given the <a id=windowproxy-set:current-global-object href=webappapis.html#current-global-object>current global object</a>'s <a id=windowproxy-set:browsing-context href=document-sequences.html#browsing-context>browsing
   context</a>, <var>W</var>'s <a id=windowproxy-set:browsing-context-2 href=document-sequences.html#browsing-context>browsing context</a>, <var>P</var>,
   and the <a id=windowproxy-set:current-settings-object href=webappapis.html#current-settings-object>current settings object</a>.<li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-set:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then:</p>

    <ol><li><p>If <var>P</var> is an <a id=windowproxy-set:array-index-property-name href=https://webidl.spec.whatwg.org/#dfn-array-index-property-name data-x-internal=array-index-property-name>array index property name</a>,
     then return false.<li><p>Return ? <a id=windowproxy-set:ordinaryset href=https://tc39.es/ecma262/#sec-ordinaryset data-x-internal=ordinaryset>OrdinarySet</a>(<var>W</var>, <var>P</var>, <var>V</var>,
     <var>Receiver</var>).</ol>
   <li>
    <p>Return ? <a href=#crossoriginset-(-o,-p,-v,-receiver-) id=windowproxy-set:crossoriginset-(-o,-p,-v,-receiver-)>CrossOriginSet</a>(<b>this</b>, <var>P</var>, <var>V</var>,
    <var>Receiver</var>).</p>

    <p class=note><b>this</b> is passed rather than <var>W</var> as <a href=#crossoriginset-(-o,-p,-v,-receiver-) id=windowproxy-set:crossoriginset-(-o,-p,-v,-receiver-)-2>CrossOriginSet</a>
    will invoke the <a href=#windowproxy-getownproperty>[[GetOwnProperty]]</a>
    internal method.</p>
   </ol>

  <h5 id=windowproxy-delete><span class=secno>7.2.3.9</span> [[Delete]] ( <var>P</var> )<a href=#windowproxy-delete class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the
   <a href=#concept-windowproxy-window id=windowproxy-delete:concept-windowproxy-window>[[Window]]</a> internal slot of
   <b>this</b>.<li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-delete:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then:

    <ol><li>
      <p>If <var>P</var> is an <a id=windowproxy-delete:array-index-property-name href=https://webidl.spec.whatwg.org/#dfn-array-index-property-name data-x-internal=array-index-property-name>array index property name</a>, then:</p>

      <ol><li><p>Let <var>desc</var> be ! <b>this</b>.[[GetOwnProperty]](<var>P</var>).<li><p>If <var>desc</var> is undefined, then return true.<li><p>Return false.</ol>
     <li><p>Return ? <a id=windowproxy-delete:ordinarydelete href=https://tc39.es/ecma262/#sec-ordinarydelete data-x-internal=ordinarydelete>OrdinaryDelete</a>(<var>W</var>, <var>P</var>).</ol>

   <li><p>Throw a <a id=windowproxy-delete:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=windowproxy-delete:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h5 id=windowproxy-ownpropertykeys><span class=secno>7.2.3.10</span> [[OwnPropertyKeys]] ( )<a href=#windowproxy-ownpropertykeys class=self-link></a></h5>

  <ol><li><p>Let <var>W</var> be the value of the <a href=#concept-windowproxy-window id=windowproxy-ownpropertykeys:concept-windowproxy-window>[[Window]]</a> internal slot of <b>this</b>.<li><p>Let <var>maxProperties</var> be <var>W</var>'s <a href=#concept-document-window id=windowproxy-ownpropertykeys:concept-document-window>associated <code>Document</code></a>'s <a id=windowproxy-ownpropertykeys:document-tree-child-navigables href=document-sequences.html#document-tree-child-navigables>document-tree
   child navigables</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=windowproxy-ownpropertykeys:list-size data-x-internal=list-size>size</a>.<li><p>Let <var>keys</var> be <a href=https://infra.spec.whatwg.org/#the-exclusive-range id=windowproxy-ownpropertykeys:exclusive-range data-x-internal=exclusive-range>the range</a> 0 to
   <var>maxProperties</var>, exclusive.<li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=windowproxy-ownpropertykeys:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<var>W</var>) is true, then return the
   concatenation of <var>keys</var> and
   <a id=windowproxy-ownpropertykeys:ordinaryownpropertykeys href=https://tc39.es/ecma262/#sec-ordinaryownpropertykeys data-x-internal=ordinaryownpropertykeys>OrdinaryOwnPropertyKeys</a>(<var>W</var>).<li><p>Return the concatenation of <var>keys</var> and !
   <a href=#crossoriginownpropertykeys-(-o-) id=windowproxy-ownpropertykeys:crossoriginownpropertykeys-(-o-)>CrossOriginOwnPropertyKeys</a>(<var>W</var>).</ol>

  


  <h4 id=the-location-interface><span class=secno>7.2.4</span> The <code id=the-location-interface:location><a href=#location>Location</a></code> interface<a href=#the-location-interface class=self-link></a></h4><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Document/location title="The Document.location read-only property returns a Location object, which contains information about the URL of the document and provides methods for changing that URL and loading another URL.">Document/location</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location title="The Location interface represents the location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.">Location</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/location title="The Window.location read-only property returns a Location object with information about the current location of the document.">Window/location</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div>

  <p>Each <code id=the-location-interface:window><a href=#window>Window</a></code> object is associated with a unique instance of a <code id=the-location-interface:location-2><a href=#location>Location</a></code>
  object, allocated when the <code id=the-location-interface:window-2><a href=#window>Window</a></code> object is created.</p>

  

  <p class=warning>The <code id=the-location-interface:location-3><a href=#location>Location</a></code> exotic object is defined through a mishmash of IDL,
  invocation of JavaScript internal methods post-creation, and overridden JavaScript internal
  methods. Coupled with its scary security policy, please take extra care while implementing
  this excrescence.</p>

  <p>To create a <code id=the-location-interface:location-4><a href=#location>Location</a></code> object, run these steps:</p>

  <ol><li><p>Let <var>location</var> be a new <code id=the-location-interface:location-5><a href=#location>Location</a></code> <a id=the-location-interface:platform-object href=https://webidl.spec.whatwg.org/#dfn-platform-object data-x-internal=platform-object>platform
   object</a>.<li><p>Let <var>valueOf</var> be <var>location</var>'s <a href=webappapis.html#concept-relevant-realm id=the-location-interface:concept-relevant-realm>relevant
   realm</a>.[[Intrinsics]].[[<a id=the-location-interface:object.prototype.valueof href=https://tc39.es/ecma262/#sec-object.prototype.valueof data-x-internal=object.prototype.valueof>%Object.prototype.valueOf%</a>]].<li><p>Perform ! <var>location</var>.[[DefineOwnProperty]]("<code>valueOf</code>", {
   [[Value]]: <var>valueOf</var>,
   [[Writable]]: false,
   [[Enumerable]]: false,
   [[Configurable]]: false }).<li><p>Perform ! <var>location</var>.[[DefineOwnProperty]](<a id=the-location-interface:symbol.toprimitive href=infrastructure.html#symbol.toprimitive>%Symbol.toPrimitive%</a>, {
   [[Value]]: undefined,
   [[Writable]]: false,
   [[Enumerable]]: false,
   [[Configurable]]: false }).<li><p>Set the value of the <a href=#defaultproperties id=the-location-interface:defaultproperties>[[DefaultProperties]]</a> internal slot of
   <var>location</var> to <var>location</var>.[[OwnPropertyKeys]]().<li><p>Return <var>location</var>.</ol>

  <p class=note>The addition of <code>valueOf</code> and <a id=the-location-interface:symbol.toprimitive-2 href=infrastructure.html#symbol.toprimitive>%Symbol.toPrimitive%</a> own
  data properties, as well as the fact that all of <code id=the-location-interface:location-6><a href=#location>Location</a></code>'s IDL attributes are marked
  <code>[<a id=the-location-interface:legacyunforgeable href=https://webidl.spec.whatwg.org/#LegacyUnforgeable data-x-internal=legacyunforgeable>LegacyUnforgeable</a>]</code>, is required by legacy code that consulted
  the <code id=the-location-interface:location-7><a href=#location>Location</a></code> interface, or stringified it, to determine the <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address" data-x-internal="the-document's-address">document URL</a>, and then used it in a security-sensitive way.
  In particular, the <code>valueOf</code>, <a id=the-location-interface:symbol.toprimitive-3 href=infrastructure.html#symbol.toprimitive>%Symbol.toPrimitive%</a>, and <code>[<a id=the-location-interface:legacyunforgeable-2 href=https://webidl.spec.whatwg.org/#LegacyUnforgeable data-x-internal=legacyunforgeable>LegacyUnforgeable</a>]</code> stringifier mitigations ensure that code such as
  <code>foo[location] = bar</code> or <code>location + ""</code> cannot be
  misdirected.</p>

  

  <dl class=domintro><dt><code><var>document</var>.<a href=#dom-document-location id=dom-document-location-dev>location</a> [ = <var>value</var> ]</code><dt><code><var>window</var>.<a href=#dom-location id=dom-location-dev>location</a> [ = <var>value</var> ]</code><dd>
    <p>Returns a <code id=the-location-interface:location-8><a href=#location>Location</a></code> object with the current page's location.</p>

    <p>Can be set, to navigate to another page.</p>
   </dl>

  

  <p>The <code id=the-location-interface:document><a href=dom.html#document>Document</a></code> object's <dfn data-dfn-for=Document id=dom-document-location data-dfn-type=attribute><code>location</code></dfn> getter steps are to return
  <a id=the-location-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-location-interface:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <code id=the-location-interface:location-9><a href=#location>Location</a></code> object, if
  <a id=the-location-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> is <a id=the-location-interface:fully-active href=document-sequences.html#fully-active>fully active</a>, and null otherwise.</p>

  <p>The <code id=the-location-interface:window-3><a href=#window>Window</a></code> object's <dfn data-dfn-for=Window id=dom-location data-dfn-type=attribute><code>location</code></dfn> getter steps are to return <a id=the-location-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s
  <code id=the-location-interface:location-10><a href=#location>Location</a></code> object.</p>

  

  <p><code id=the-location-interface:location-11><a href=#location>Location</a></code> objects provide a representation of the <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address-2" data-x-internal="the-document's-address">URL</a> of their associated <code id=the-location-interface:document-2><a href=dom.html#document>Document</a></code>, as well as
  methods for <a href=browsing-the-web.html#navigate id=the-location-interface:navigate>navigating</a> and <a href=browsing-the-web.html#reload id=the-location-interface:reload>reloading</a>
  the associated <a id=the-location-interface:navigable href=document-sequences.html#navigable>navigable</a>.</p>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='location' data-dfn-type='interface'><c- g>Location</c-></dfn> { // but see also <a href='#the-location-interface'>additional creation steps</a> and <a href='#location-internal-methods'>overridden internal methods</a>
  [<a id='the-location-interface:legacyunforgeable-3' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>stringifier</c-> <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-href' id='the-location-interface:dom-location-href'><c- g>href</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-4' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-origin' id='the-location-interface:dom-location-origin'><c- g>origin</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-5' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-protocol' id='the-location-interface:dom-location-protocol'><c- g>protocol</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-6' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-host' id='the-location-interface:dom-location-host'><c- g>host</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-7' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-hostname' id='the-location-interface:dom-location-hostname'><c- g>hostname</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-8' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-port' id='the-location-interface:dom-location-port'><c- g>port</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-9' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-pathname' id='the-location-interface:dom-location-pathname'><c- g>pathname</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-10' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-search' id='the-location-interface:dom-location-search'><c- g>search</c-></a>;
  [<a id='the-location-interface:legacyunforgeable-11' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-location-hash' id='the-location-interface:dom-location-hash'><c- g>hash</c-></a>;

  [<a id='the-location-interface:legacyunforgeable-12' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>undefined</c-> <a href='#dom-location-assign' id='the-location-interface:dom-location-assign'><c- g>assign</c-></a>(<c- b>USVString</c-> <c- g>url</c->);
  [<a id='the-location-interface:legacyunforgeable-13' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>undefined</c-> <a href='#dom-location-replace' id='the-location-interface:dom-location-replace'><c- g>replace</c-></a>(<c- b>USVString</c-> <c- g>url</c->);
  [<a id='the-location-interface:legacyunforgeable-14' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>] <c- b>undefined</c-> <a href='#dom-location-reload' id='the-location-interface:dom-location-reload'><c- g>reload</c-></a>();

  [<a id='the-location-interface:legacyunforgeable-15' href='https://webidl.spec.whatwg.org/#LegacyUnforgeable' data-x-internal='legacyunforgeable'><c- g>LegacyUnforgeable</c-></a>, <c- g>SameObject</c->] <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-location-interface:domstringlist' href='common-dom-interfaces.html#domstringlist'><c- n>DOMStringList</c-></a> <a href='#dom-location-ancestororigins' id='the-location-interface:dom-location-ancestororigins'><c- g>ancestorOrigins</c-></a>;
};</code></pre>

  <dl class=domintro><dt><code><var>location</var>.<span>toString()</span></code><dt><code><var>location</var>.<a href=#dom-location-href id=dom-location-href-dev>href</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/href title="The href property of the Location interface is a stringifier that returns a string containing the whole URL, and allows the href to be updated.">Location/href</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/toString title="The toString() stringifier method of the Location interface returns a string containing the whole URL. It is a read-only version of Location.href.">Location/toString</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>22+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>52+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>11</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-12><a href=#location>Location</a></code> object's URL.</p>

    <p>Can be set, to navigate to the given URL.</p>
   <dt><code><var>location</var>.<a href=#dom-location-origin id=dom-location-origin-dev>origin</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/origin title="The origin read-only property of the Location interface is a string containing the Unicode serialization of the origin of the represented URL.">Location/origin</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>21+</span></span><span class="safari yes"><span>Safari</span><span>5.1+</span></span><span class="chrome yes"><span>Chrome</span><span>8+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>11</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>3+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd><p>Returns the <code id=the-location-interface:location-13><a href=#location>Location</a></code> object's URL's origin.<dt><code><var>location</var>.<a href=#dom-location-protocol id=dom-location-protocol-dev>protocol</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/protocol title="The protocol property of the Location interface is a string representing the protocol scheme of the URL, including the final ':'.">Location/protocol</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-14><a href=#location>Location</a></code> object's URL's scheme.</p>

    <p>Can be set, to navigate to the same URL with a changed scheme.</p>
   <dt><code><var>location</var>.<a href=#dom-location-host id=dom-location-host-dev>host</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/host title="The host property of the Location interface is a string containing the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', and the port of the URL.">Location/host</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-15><a href=#location>Location</a></code> object's URL's host and port (if different from the default
    port for the scheme).</p>

    <p>Can be set, to navigate to the same URL with a changed host and port.</p>
   <dt><code><var>location</var>.<a href=#dom-location-hostname id=dom-location-hostname-dev>hostname</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/hostname title="The hostname property of the Location interface is a string containing the domain of the URL.">Location/hostname</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-16><a href=#location>Location</a></code> object's URL's host.</p>

    <p>Can be set, to navigate to the same URL with a changed host.</p>
   <dt><code><var>location</var>.<a href=#dom-location-port id=dom-location-port-dev>port</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/port title="The port property of the Location interface is a string containing the port number of the URL. If the URL does not contain an explicit port number, it will be set to ''.">Location/port</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-17><a href=#location>Location</a></code> object's URL's port.</p>

    <p>Can be set, to navigate to the same URL with a changed port.</p>
   <dt><code><var>location</var>.<a href=#dom-location-pathname id=dom-location-pathname-dev>pathname</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname title="The pathname property of the Location interface is a string containing the path of the URL for the location. If there is no path, pathname will be empty: otherwise, pathname contains an initial '/' followed by the path of the URL, not including the query string or fragment.">Location/pathname</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-18><a href=#location>Location</a></code> object's URL's path.</p>

    <p>Can be set, to navigate to the same URL with a changed path.</p>
   <dt><code><var>location</var>.<a href=#dom-location-search id=dom-location-search-dev>search</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/search title="The search property of the Location interface is a search string, also called a query string; that is, a string containing a '?' followed by the parameters of the URL.">Location/search</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-19><a href=#location>Location</a></code> object's URL's query (includes leading "<code>?</code>" if non-empty).</p>

    <p>Can be set, to navigate to the same URL with a changed query (ignores leading "<code>?</code>").</p>
   <dt><code><var>location</var>.<a href=#dom-location-hash id=dom-location-hash-dev>hash</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/hash title="The hash property of the Location interface returns a string containing a '#' followed by the fragment identifier of the URL — the ID on the page that the URL is trying to target.">Location/hash</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>3+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <code id=the-location-interface:location-20><a href=#location>Location</a></code> object's URL's fragment (includes leading "<code>#</code>" if non-empty).</p>

    <p>Can be set, to navigate to the same URL with a changed fragment (ignores leading "<code>#</code>").</p>
   <dt><code><var>location</var>.<a href=#dom-location-assign id=dom-location-assign-dev>assign</a>(<var>url</var>)</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/assign title="The Location.assign() method causes the window to load and display the document at the URL specified. After the navigation occurs, the user can navigate back to the page that called Location.assign() by pressing the &quot;back&quot; button.">Location/assign</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>3+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>5.5+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>1+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd><p>Navigates to the given URL.<dt><code><var>location</var>.<a href=#dom-location-replace id=dom-location-replace-dev>replace</a>(<var>url</var>)</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/replace title="The replace() method of the Location interface replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.">Location/replace</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>5.5+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd><p>Removes the current page from the session history and navigates to the given URL.<dt><code><var>location</var>.<a href=#dom-location-reload id=dom-location-reload-dev>reload</a>()</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/reload title="The location.reload() method reloads the current URL, like the Refresh button.">Location/reload</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>5.5+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div><dd><p>Reloads the current page.<dt><code><var>location</var>.<a href=#dom-location-ancestororigins id=dom-location-ancestororigins-dev>ancestorOrigins</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins title="The ancestorOrigins read-only property of the Location interface is a static DOMStringList containing, in reverse order, the origins of all ancestor browsing contexts of the document associated with the given Location object.">Location/ancestorOrigins</a><div class=support><span class="firefox no"><span>Firefox</span><span>No</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>20+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge unknown"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd>
    <p>Returns a <code id=the-location-interface:domstringlist-2><a href=common-dom-interfaces.html#domstringlist>DOMStringList</a></code> object listing the origins of the <a id=the-location-interface:ancestor-navigables href=document-sequences.html#ancestor-navigables>ancestor navigables</a>' <a href=document-sequences.html#nav-document id=the-location-interface:nav-document>active documents</a>.</p>
   </dl>

  

  <p>A <code id=the-location-interface:location-21><a href=#location>Location</a></code> object has an associated <dfn id=relevant-document>relevant <code>Document</code></dfn>,
  which is its <a id=the-location-interface:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-bc id=the-location-interface:window-bc>browsing context</a>'s <a id=the-location-interface:active-document href=document-sequences.html#active-document>active document</a>, if this
  <code id=the-location-interface:location-22><a href=#location>Location</a></code> object's <a id=the-location-interface:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-bc id=the-location-interface:window-bc-2>browsing context</a> is non-null, and null otherwise.</p>

  <p>A <code id=the-location-interface:location-23><a href=#location>Location</a></code> object has an associated <dfn id=concept-location-url>url</dfn>,
  which is this <code id=the-location-interface:location-24><a href=#location>Location</a></code> object's <a href=#relevant-document id=the-location-interface:relevant-document>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address-3" data-x-internal="the-document's-address">URL</a>, if this <code id=the-location-interface:location-25><a href=#location>Location</a></code> object's <a href=#relevant-document id=the-location-interface:relevant-document-2>relevant
  <code>Document</code></a> is non-null, and <code id=the-location-interface:about:blank><a href=infrastructure.html#about:blank>about:blank</a></code> otherwise.</p>

  <p>A <code id=the-location-interface:location-26><a href=#location>Location</a></code> object has an associated <dfn id=concept-location-ancestor-origins-list>ancestor origins list</dfn>. When a
  <code id=the-location-interface:location-27><a href=#location>Location</a></code> object is created, its <a href=#concept-location-ancestor-origins-list id=the-location-interface:concept-location-ancestor-origins-list>ancestor origins list</a> must be set to a
  <code id=the-location-interface:domstringlist-3><a href=common-dom-interfaces.html#domstringlist>DOMStringList</a></code> object whose associated list is the <a id=the-location-interface:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of strings that
  the following steps would produce:</p>

  <ol><li><p>Let <var>output</var> be a new <a id=the-location-interface:list-2 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of strings.<li><p>Let <var>current</var> be the <code id=the-location-interface:location-28><a href=#location>Location</a></code> object's <a href=#relevant-document id=the-location-interface:relevant-document-3>relevant
   <code>Document</code></a>.<li>
    <p>While <var>current</var>'s <a href=document-sequences.html#doc-container-document id=the-location-interface:doc-container-document>container document</a>
    is non-null:</p>

    <ol><li><p>Set <var>current</var> to <var>current</var>'s <a href=document-sequences.html#doc-container-document id=the-location-interface:doc-container-document-2>container document</a>.<li><p><a href=https://infra.spec.whatwg.org/#list-append id=the-location-interface:list-append data-x-internal=list-append>Append</a> the <a href=browsers.html#ascii-serialisation-of-an-origin id=the-location-interface:ascii-serialisation-of-an-origin>serialization</a> of <var>current</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin data-x-internal=concept-document-origin>origin</a> to <var>output</var>.</ol>
   <li><p>Return <var>output</var>.</ol>

  <p>To <dfn id=location-object-navigate><code>Location</code>-object navigate</dfn> a <code id=the-location-interface:location-29><a href=#location>Location</a></code> object
  <var>location</var> to a <a id=the-location-interface:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> <var>url</var>, optionally given a <code id=the-location-interface:navigationhistorybehavior><a href=#navigationhistorybehavior>NavigationHistoryBehavior</a></code> <var>historyHandling</var>
  (default "<code id=the-location-interface:navigationhistorybehavior-auto><a href=browsing-the-web.html#navigationhistorybehavior-auto>auto</a></code>"):</p>

  <ol><li><p>Let <var>navigable</var> be <var>location</var>'s <a id=the-location-interface:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#window-navigable id=the-location-interface:window-navigable>navigable</a>.<li><p>Let <var>sourceDocument</var> be the <a href=webappapis.html#concept-incumbent-global id=the-location-interface:concept-incumbent-global>incumbent
   global object</a>'s <a href=#concept-document-window id=the-location-interface:concept-document-window>associated
   <code>Document</code></a>.<li><p>If <var>location</var>'s <a href=#relevant-document id=the-location-interface:relevant-document-4>relevant <code>Document</code></a> is not yet
   <a id=the-location-interface:completely-loaded href=document-lifecycle.html#completely-loaded>completely loaded</a>, and the <a href=webappapis.html#concept-incumbent-global id=the-location-interface:concept-incumbent-global-2>incumbent global
   object</a> does not have <a id=the-location-interface:transient-activation href=interaction.html#transient-activation>transient activation</a>, then set
   <var>historyHandling</var> to "<code id=the-location-interface:navigationhistorybehavior-replace><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>".<li><p><a id=the-location-interface:navigate-2 href=browsing-the-web.html#navigate>Navigate</a> <var>navigable</var> to <var>url</var> using
   <var>sourceDocument</var>, with <i><a id=the-location-interface:exceptions-enabled href=browsing-the-web.html#exceptions-enabled>exceptionsEnabled</a></i> set to true and <i id=the-location-interface:navigation-hh><a href=browsing-the-web.html#navigation-hh>historyHandling</a></i> set to <var>historyHandling</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-href data-dfn-type=attribute><code>href</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-5>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-2 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin>origin</a>, then throw a
   <a id=the-location-interface:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return <a id=the-location-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url>url</a>, <a href=https://url.spec.whatwg.org/#concept-url-serializer id=the-location-interface:concept-url-serializer data-x-internal=concept-url-serializer>serialized</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-href-2><a href=#dom-location-href>href</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-6>relevant <code>Document</code></a> is null, then
   return.<li><p>Let <var>url</var> be the result of <a id=the-location-interface:encoding-parsing-a-url href=urls-and-fetching.html#encoding-parsing-a-url>encoding-parsing a URL</a> given the given
   value, relative to the <a id=the-location-interface:entry-settings-object-2 href=webappapis.html#entry-settings-object>entry settings object</a>.<li><p>If <var>url</var> is failure, then throw a <a id=the-location-interface:syntaxerror href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a>
   <code id=the-location-interface:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate><code>Location</code>-object navigate</a> <a id=the-location-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>url</var>.</ol>

  <p class=note>The <code id=the-location-interface:dom-location-href-3><a href=#dom-location-href>href</a></code> setter intentionally has no
  security check.</p>

  <p>The <dfn data-dfn-for=Location id=dom-location-origin data-dfn-type=attribute><code>origin</code></dfn>
  getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-7>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-3 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-2 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-3 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-2>origin</a>, then throw a
   <a id=the-location-interface:securityerror-2 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return the <a href=browsers.html#ascii-serialisation-of-an-origin id=the-location-interface:ascii-serialisation-of-an-origin-2>serialization</a> of
   <a id=the-location-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-2>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-origin id=the-location-interface:concept-url-origin data-x-internal=concept-url-origin>origin</a>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-protocol data-dfn-type=attribute><code>protocol</code></dfn>
  getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-8>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-4 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-3 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-4 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-3>origin</a>, then throw a
   <a id=the-location-interface:securityerror-3 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return <a id=the-location-interface:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-3>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-location-interface:concept-url-scheme data-x-internal=concept-url-scheme>scheme</a>, followed by "<code>:</code>".</ol>

  <p>The <code id=the-location-interface:dom-location-protocol-2><a href=#dom-location-protocol>protocol</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-12 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-9>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-13 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-10>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-5 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-4 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-5 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-4>origin</a>, then throw a
   <a id=the-location-interface:securityerror-4 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-5><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-14 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-4>url</a>.<li>
    <p>Let <var>possibleFailure</var> be the result of <a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser data-x-internal=basic-url-parser>basic URL
    parsing</a> the given value, followed by "<code>:</code>", with <var>copyURL</var>
    as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:scheme-start-state href=https://url.spec.whatwg.org/#scheme-start-state data-x-internal=scheme-start-state>scheme start state</a> as
    <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override data-x-internal=basic-url-parser-state-override><i>state override</i></a>.</p>

    <p class=note>Because the URL parser ignores multiple consecutive colons, providing a value
    of "<code>https:</code>" (or even "<code>https::::</code>") is the same as
    providing a value of "<code>https</code>".</p>
   <li><p>If <var>possibleFailure</var> is failure, then throw a
   <a id=the-location-interface:syntaxerror-2 href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a> <code id=the-location-interface:domexception-6><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-location-interface:concept-url-scheme-2 data-x-internal=concept-url-scheme>scheme</a> is not an
   <a id=the-location-interface:http(s)-scheme href=https://fetch.spec.whatwg.org/#http-scheme data-x-internal=http(s)-scheme>HTTP(S) scheme</a>, then terminate these steps.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-2><code>Location</code>-object navigate</a> <a id=the-location-interface:this-15 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-host data-dfn-type=attribute><code>host</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-16 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-11>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-6 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-5 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-6 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-5>origin</a>, then throw a
   <a id=the-location-interface:securityerror-5 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-7><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>url</var> be <a id=the-location-interface:this-17 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-5>url</a>.<li><p>If <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-host id=the-location-interface:concept-url-host data-x-internal=concept-url-host>host</a> is null, return the empty
   string.<li><p>If <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-port id=the-location-interface:concept-url-port data-x-internal=concept-url-port>port</a> is null, return
   <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-host id=the-location-interface:concept-url-host-2 data-x-internal=concept-url-host>host</a>, <a href=https://url.spec.whatwg.org/#concept-host-serializer id=the-location-interface:host-serializer data-x-internal=host-serializer>serialized</a>.<li><p>Return <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-host id=the-location-interface:concept-url-host-3 data-x-internal=concept-url-host>host</a>, <a href=https://url.spec.whatwg.org/#concept-host-serializer id=the-location-interface:host-serializer-2 data-x-internal=host-serializer>serialized</a>, followed by "<code>:</code>" and <var>url</var>'s <a href=https://url.spec.whatwg.org/#concept-url-port id=the-location-interface:concept-url-port-2 data-x-internal=concept-url-port>port</a>, <a href=https://url.spec.whatwg.org/#serialize-an-integer id=the-location-interface:serialize-an-integer data-x-internal=serialize-an-integer>serialized</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-host-2><a href=#dom-location-host>host</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-18 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-12>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-19 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-13>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-7 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-6 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-7 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-6>origin</a>, then throw a
   <a id=the-location-interface:securityerror-6 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-8><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-20 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-6>url</a>.<li><p>If <var>copyURL</var> has an <a id=the-location-interface:opaque-path href=https://url.spec.whatwg.org/#url-opaque-path data-x-internal=opaque-path>opaque path</a>, then return.<li><p><a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-2 data-x-internal=basic-url-parser>Basic URL parse</a> the given value, with
   <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-2 data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:host-state href=https://url.spec.whatwg.org/#host-state data-x-internal=host-state>host
   state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-2 data-x-internal=basic-url-parser-state-override><i>state
   override</i></a>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-3><code>Location</code>-object navigate</a> <a id=the-location-interface:this-21 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-hostname data-dfn-type=attribute><code>hostname</code></dfn>
  getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-22 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-14>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-8 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-7 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-8 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-7>origin</a>, then throw a
   <a id=the-location-interface:securityerror-7 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-9><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-location-interface:this-23 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-7>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-host id=the-location-interface:concept-url-host-4 data-x-internal=concept-url-host>host</a> is null, return the empty string.<li><p>Return <a id=the-location-interface:this-24 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-8>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-host id=the-location-interface:concept-url-host-5 data-x-internal=concept-url-host>host</a>, <a href=https://url.spec.whatwg.org/#concept-host-serializer id=the-location-interface:host-serializer-3 data-x-internal=host-serializer>serialized</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-hostname-2><a href=#dom-location-hostname>hostname</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-25 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-15>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-26 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-16>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-9 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-8 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-9 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-8>origin</a>, then throw a
   <a id=the-location-interface:securityerror-8 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-10><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-27 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-9>url</a>.<li><p>If <var>copyURL</var> has an <a id=the-location-interface:opaque-path-2 href=https://url.spec.whatwg.org/#url-opaque-path data-x-internal=opaque-path>opaque path</a>, then return.<li><p><a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-3 data-x-internal=basic-url-parser>Basic URL parse</a> the given value, with
   <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-3 data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:hostname-state href=https://url.spec.whatwg.org/#hostname-state data-x-internal=hostname-state>hostname
   state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-3 data-x-internal=basic-url-parser-state-override><i>state
   override</i></a>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-4><code>Location</code>-object navigate</a> <a id=the-location-interface:this-28 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-port data-dfn-type=attribute><code>port</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-29 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-17>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-10 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-9 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-10 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-9>origin</a>, then throw a
   <a id=the-location-interface:securityerror-9 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-11><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-location-interface:this-30 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-10>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-port id=the-location-interface:concept-url-port-3 data-x-internal=concept-url-port>port</a> is null, return the empty string.<li><p>Return <a id=the-location-interface:this-31 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-11>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-port id=the-location-interface:concept-url-port-4 data-x-internal=concept-url-port>port</a>, <a href=https://url.spec.whatwg.org/#serialize-an-integer id=the-location-interface:serialize-an-integer-2 data-x-internal=serialize-an-integer>serialized</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-port-2><a href=#dom-location-port>port</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-32 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-18>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-33 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-19>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-11 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-10 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-11 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-10>origin</a>, then throw a
   <a id=the-location-interface:securityerror-10 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-12><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-34 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-12>url</a>.<li><p>If <var>copyURL</var> <a id=the-location-interface:cannot-have-a-username/password/port href=https://url.spec.whatwg.org/#cannot-have-a-username-password-port data-x-internal=cannot-have-a-username/password/port>cannot have a username/password/port</a>, then
   return.<li><p>If the given value is the empty string, then set <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-port id=the-location-interface:concept-url-port-5 data-x-internal=concept-url-port>port</a> to null.<li><p>Otherwise, <a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-4 data-x-internal=basic-url-parser>basic URL parse</a> the given value, with
   <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-4 data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:port-state href=https://url.spec.whatwg.org/#port-state data-x-internal=port-state>port
   state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-4 data-x-internal=basic-url-parser-state-override><i>state
   override</i></a>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-5><code>Location</code>-object navigate</a> <a id=the-location-interface:this-35 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-pathname data-dfn-type=attribute><code>pathname</code></dfn>
  getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-36 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-20>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-12 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-11 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-12 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-11>origin</a>, then throw a
   <a id=the-location-interface:securityerror-11 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-13><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return the result of <a href=https://url.spec.whatwg.org/#url-path-serializer id=the-location-interface:url-path-serializer data-x-internal=url-path-serializer>URL path serializing</a> this
   <code id=the-location-interface:location-30><a href=#location>Location</a></code> object's <a href=#concept-location-url id=the-location-interface:concept-location-url-13>url</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-pathname-2><a href=#dom-location-pathname>pathname</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-37 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-21>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-38 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-22>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-13 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-12 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-13 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-12>origin</a>, then throw a
   <a id=the-location-interface:securityerror-12 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-14><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-39 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-14>url</a>.<li><p>If <var>copyURL</var> has an <a id=the-location-interface:opaque-path-3 href=https://url.spec.whatwg.org/#url-opaque-path data-x-internal=opaque-path>opaque path</a>, then return.<li><p>Set <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-path id=the-location-interface:concept-url-path data-x-internal=concept-url-path>path</a> to the empty
   list.<li><p><a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-5 data-x-internal=basic-url-parser>Basic URL parse</a> the given value, with
   <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-5 data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:path-start-state href=https://url.spec.whatwg.org/#path-start-state data-x-internal=path-start-state>path start
   state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-5 data-x-internal=basic-url-parser-state-override><i>state
   override</i></a>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-6><code>Location</code>-object navigate</a> <a id=the-location-interface:this-40 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-search data-dfn-type=attribute><code>search</code></dfn>
  getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-41 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-23>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-14 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-13 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-14 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-13>origin</a>, then throw a
   <a id=the-location-interface:securityerror-13 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-15><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-location-interface:this-42 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-15>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-query id=the-location-interface:concept-url-query data-x-internal=concept-url-query>query</a> is either null or the empty string, return the empty
   string.<li><p>Return "<code>?</code>", followed by <a id=the-location-interface:this-43 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-16>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-query id=the-location-interface:concept-url-query-2 data-x-internal=concept-url-query>query</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-search-2><a href=#dom-location-search>search</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-44 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-24>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-45 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-25>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-15 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-14 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-15 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-14>origin</a>, then throw a
   <a id=the-location-interface:securityerror-14 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-16><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-46 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-17>url</a>.<li><p>If the given value is the empty string, set <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-query id=the-location-interface:concept-url-query-3 data-x-internal=concept-url-query>query</a> to null.

   <li>
    <p>Otherwise, run these substeps:</p>

    <ol><li><p>Let <var>input</var> be the given value with a single leading "<code>?</code>" removed, if any.<li><p>Set <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-query id=the-location-interface:concept-url-query-4 data-x-internal=concept-url-query>query</a> to the empty
     string.<li><p><a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-6 data-x-internal=basic-url-parser>Basic URL parse</a> <var>input</var>, with null, the
     <a href=#relevant-document id=the-location-interface:relevant-document-26>relevant <code>Document</code></a>'s <a id="the-location-interface:document's-character-encoding" href=https://dom.spec.whatwg.org/#concept-document-encoding data-x-internal="document's-character-encoding">document's character encoding</a>,
     <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-6 data-x-internal=basic-url-parser-url><i>url</i></a>, and <a id=the-location-interface:query-state href=https://url.spec.whatwg.org/#query-state data-x-internal=query-state>query
     state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-6 data-x-internal=basic-url-parser-state-override><i>state
     override</i></a>.</ol>
   <li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-7><code>Location</code>-object navigate</a> <a id=the-location-interface:this-47 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-hash data-dfn-type=attribute><code>hash</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-48 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-27>relevant <code>Document</code></a> is non-null and its
   <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-16 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-15 href=browsers.html#same-origin-domain>same origin-domain</a> with
   the <a id=the-location-interface:entry-settings-object-16 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-15>origin</a>, then throw a
   <a id=the-location-interface:securityerror-15 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-17><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-location-interface:this-49 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-18>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-location-interface:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a> is either null or the empty string, return the
   empty string.<li><p>Return "<code>#</code>", followed by <a id=the-location-interface:this-50 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-19>url</a>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-location-interface:concept-url-fragment-2 data-x-internal=concept-url-fragment>fragment</a>.</ol>

  <p>The <code id=the-location-interface:dom-location-hash-2><a href=#dom-location-hash>hash</a></code> setter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-51 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-28>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-52 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-29>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-17 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-16 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-17 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-16>origin</a>, then throw a
   <a id=the-location-interface:securityerror-16 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-18><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>copyURL</var> be a copy of <a id=the-location-interface:this-53 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-url id=the-location-interface:concept-location-url-20>url</a>.<li><p>Let <var>thisURLFragment</var> be <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-location-interface:concept-url-fragment-3 data-x-internal=concept-url-fragment>fragment</a> if it is non-null; otherwise the empty
   string.<li><p>Let <var>input</var> be the given value with a single leading "<code>#</code>"
   removed, if any.<li><p>Set <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-location-interface:concept-url-fragment-4 data-x-internal=concept-url-fragment>fragment</a> to the empty
   string.<li><p><a href=https://url.spec.whatwg.org/#concept-basic-url-parser id=the-location-interface:basic-url-parser-7 data-x-internal=basic-url-parser>Basic URL parse</a> <var>input</var>, with
   <var>copyURL</var> as <a href=https://url.spec.whatwg.org/#basic-url-parser-url id=the-location-interface:basic-url-parser-url-7 data-x-internal=basic-url-parser-url><i>url</i></a> and <a id=the-location-interface:fragment-state href=https://url.spec.whatwg.org/#fragment-state data-x-internal=fragment-state>fragment
   state</a> as <a href=https://url.spec.whatwg.org/#basic-url-parser-state-override id=the-location-interface:basic-url-parser-state-override-7 data-x-internal=basic-url-parser-state-override><i>state
   override</i></a>.<li>
    <p>If <var>copyURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-location-interface:concept-url-fragment-5 data-x-internal=concept-url-fragment>fragment</a> is
    <var>thisURLFragment</var>, then return.</p>

    <p class=note>This bailout is necessary for compatibility with deployed content, which <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1733797#c2">redundantly sets <code>location.hash</code> on scroll</a>. It does not apply to other
    mechanisms of fragment navigation, such as the <code id=the-location-interface:dom-location-href-4><a href=#dom-location-href>location.href</a></code> setter or <code id=the-location-interface:dom-location-assign-2><a href=#dom-location-assign>location.assign()</a></code>.</p>
   <li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-8><code>Location</code>-object navigate</a> <a id=the-location-interface:this-54 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>copyURL</var>.</ol>

  <p class=note>Unlike the equivalent API for the <code id=the-location-interface:the-a-element><a href=text-level-semantics.html#the-a-element>a</a></code> and <code id=the-location-interface:the-area-element><a href=image-maps.html#the-area-element>area</a></code> elements,
  the <code id=the-location-interface:dom-location-hash-3><a href=#dom-location-hash>hash</a></code> setter does not special case the empty string, to
  remain compatible with deployed scripts.</p>

  <hr>

  <p>The <dfn data-dfn-for=Location id=dom-location-assign data-dfn-type=method><code>assign(<var>url</var>)</code></dfn> method steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-55 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-30>relevant <code>Document</code></a> is null, then
   return.<li><p>If <a id=the-location-interface:this-56 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-31>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-18 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-17 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-18 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-17>origin</a>, then throw a
   <a id=the-location-interface:securityerror-17 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-19><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>urlRecord</var> be the result of <a id=the-location-interface:encoding-parsing-a-url-2 href=urls-and-fetching.html#encoding-parsing-a-url>encoding-parsing a URL</a> given
   <var>url</var>, relative to the <a id=the-location-interface:entry-settings-object-19 href=webappapis.html#entry-settings-object>entry settings object</a>.<li><p>If <var>urlRecord</var> is failure, then throw a <a id=the-location-interface:syntaxerror-3 href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a>
   <code id=the-location-interface:domexception-20><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-9><code>Location</code>-object navigate</a> <a id=the-location-interface:this-57 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>urlRecord</var>.</ol>

  <p>The <dfn data-dfn-for=Location id=dom-location-replace data-dfn-type=method><code>replace(<var>url</var>)</code></dfn> method steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-58 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-32>relevant <code>Document</code></a> is null, then
   return.<li><p>Let <var>urlRecord</var> be the result of <a id=the-location-interface:encoding-parsing-a-url-3 href=urls-and-fetching.html#encoding-parsing-a-url>encoding-parsing a URL</a> given
   <var>url</var>, relative to the <a id=the-location-interface:entry-settings-object-20 href=webappapis.html#entry-settings-object>entry settings object</a>.<li><p>If <var>urlRecord</var> is failure, then throw a <a id=the-location-interface:syntaxerror-4 href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a>
   <code id=the-location-interface:domexception-21><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a href=#location-object-navigate id=the-location-interface:location-object-navigate-10><code>Location</code>-object navigate</a> <a id=the-location-interface:this-59 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> to
   <var>urlRecord</var> given "<code id=the-location-interface:navigationhistorybehavior-replace-2><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>".</ol>

  <p class=note>The <code id=the-location-interface:dom-location-replace-2><a href=#dom-location-replace>replace()</a></code> method intentionally has
  no security check.</p>

  <p>The <dfn data-dfn-for=Location id=dom-location-reload data-dfn-type=method><code>reload()</code></dfn> method
  steps are:</p>

  <ol><li><p>Let <var>document</var> be <a id=the-location-interface:this-60 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-33>relevant
   <code>Document</code></a>.<li><p>If <var>document</var> is null, then return.<li><p>If <var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-19 data-x-internal=concept-document-origin>origin</a> is not
   <a id=the-location-interface:same-origin-domain-18 href=browsers.html#same-origin-domain>same origin-domain</a> with the <a id=the-location-interface:entry-settings-object-21 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-18>origin</a>, then throw a
   <a id=the-location-interface:securityerror-18 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-22><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a id=the-location-interface:reload-2 href=browsing-the-web.html#reload>Reload</a> <var>document</var>'s <a id=the-location-interface:node-navigable href=document-sequences.html#node-navigable>node navigable</a>.</ol>

  <hr>

  <p>The <dfn data-dfn-for=Location id=dom-location-ancestororigins data-dfn-type=attribute><code>ancestorOrigins</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-location-interface:this-61 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-34>relevant <code>Document</code></a> is null, then return
   an empty <a id=the-location-interface:list-3 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li><p>If <a id=the-location-interface:this-62 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#relevant-document id=the-location-interface:relevant-document-35>relevant <code>Document</code></a>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-location-interface:concept-document-origin-20 data-x-internal=concept-document-origin>origin</a> is not <a id=the-location-interface:same-origin-domain-19 href=browsers.html#same-origin-domain>same origin-domain</a> with the
   <a id=the-location-interface:entry-settings-object-22 href=webappapis.html#entry-settings-object>entry settings object</a>'s <a href=webappapis.html#concept-settings-object-origin id=the-location-interface:concept-settings-object-origin-19>origin</a>, then throw a
   <a id=the-location-interface:securityerror-19 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-location-interface:domexception-23><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Otherwise, return <a id=the-location-interface:this-63 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-location-ancestor-origins-list id=the-location-interface:concept-location-ancestor-origins-list-2>ancestor origins list</a>.</ol>

  <p class=warning>The details of how the <code id=the-location-interface:dom-location-ancestororigins-2><a href=#dom-location-ancestororigins>ancestorOrigins</a></code> attribute works are still
  controversial and might change. See <a href=https://github.com/whatwg/html/issues/1918>issue
  #1918</a> for more information.</p>

  <hr>

  <p id=location-internal-methods>As explained earlier, the <code id=the-location-interface:location-31><a href=#location>Location</a></code> exotic object
  requires additional logic beyond IDL for security purposes. The <code id=the-location-interface:location-32><a href=#location>Location</a></code> object must
  use the ordinary internal methods except where it is explicitly specified otherwise below.</p>

  <p>Also, every <code id=the-location-interface:location-33><a href=#location>Location</a></code> object has a <dfn id=defaultproperties>[[DefaultProperties]]</dfn> internal slot
  representing its own properties at time of its creation.</p>

  <h5 id=location-getprototypeof><span class=secno>7.2.4.1</span> [[GetPrototypeOf]] ( )<a href=#location-getprototypeof class=self-link></a></h5>

  <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-getprototypeof:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then return !
   <a id=location-getprototypeof:ordinarygetprototypeof href=https://tc39.es/ecma262/#sec-ordinarygetprototypeof data-x-internal=ordinarygetprototypeof>OrdinaryGetPrototypeOf</a>(<b>this</b>).<li><p>Return null.</ol>

  <h5 id=location-setprototypeof><span class=secno>7.2.4.2</span> [[SetPrototypeOf]] ( <var>V</var> )<a href=#location-setprototypeof class=self-link></a></h5>

  <ol><li><p>Return ! <a id=location-setprototypeof:setimmutableprototype href=https://tc39.es/ecma262/#sec-set-immutable-prototype data-x-internal=setimmutableprototype>SetImmutablePrototype</a>(<b>this</b>, <var>V</var>).</ol>

  <h5 id=location-isextensible><span class=secno>7.2.4.3</span> [[IsExtensible]] ( )<a href=#location-isextensible class=self-link></a></h5>

  <ol><li><p>Return true.</ol>

  <h5 id=location-preventextensions><span class=secno>7.2.4.4</span> [[PreventExtensions]] ( )<a href=#location-preventextensions class=self-link></a></h5>

  <ol><li><p>Return false.</ol>

  <h5 id=location-getownproperty><span class=secno>7.2.4.5</span> [[GetOwnProperty]] ( <var>P</var> )<a href=#location-getownproperty class=self-link></a></h5>

  <ol><li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-getownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then:</p>

    <ol><li><p>Let <var>desc</var> be <a id=location-getownproperty:ordinarygetownproperty href=https://tc39.es/ecma262/#sec-ordinarygetownproperty data-x-internal=ordinarygetownproperty>OrdinaryGetOwnProperty</a>(<b>this</b>,
     <var>P</var>).<li><p>If the value of the <a href=#defaultproperties id=location-getownproperty:defaultproperties>[[DefaultProperties]]</a> internal slot of <b>this</b>
     contains <var>P</var>, then set <var>desc</var>.[[Configurable]] to true.<li><p>Return <var>desc</var>.</ol>
   <li><p>Let <var>property</var> be <a href=#crossorigingetownpropertyhelper-(-o,-p-) id=location-getownproperty:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper</a>(<b>this</b>,
   <var>P</var>).<li><p>If <var>property</var> is not undefined, then return <var>property</var>.<li><p>Return ? <a href=#crossoriginpropertyfallback-(-p-) id=location-getownproperty:crossoriginpropertyfallback-(-p-)>CrossOriginPropertyFallback</a>(<var>P</var>).</ol>

  <h5 id=location-defineownproperty><span class=secno>7.2.4.6</span> [[DefineOwnProperty]] ( <var>P</var>, <var>Desc</var> )<a href=#location-defineownproperty class=self-link></a></h5>

  <ol><li>
    <p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-defineownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then:</p>

    <ol><li><p>If the value of the <a href=#defaultproperties id=location-defineownproperty:defaultproperties>[[DefaultProperties]]</a> internal slot of <b>this</b>
     contains <var>P</var>, then return false.<li><p>Return ? <a id=location-defineownproperty:ordinarydefineownproperty href=https://tc39.es/ecma262/#sec-ordinarydefineownproperty data-x-internal=ordinarydefineownproperty>OrdinaryDefineOwnProperty</a>(<b>this</b>, <var>P</var>,
     <var>Desc</var>).</ol>
   <li><p>Throw a <a id=location-defineownproperty:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=location-defineownproperty:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h5 id=location-get><span class=secno>7.2.4.7</span> [[Get]] ( <var>P</var>, <var>Receiver</var> )<a href=#location-get class=self-link></a></h5>

  <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-get:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then return ?
   <a id=location-get:ordinaryget href=https://tc39.es/ecma262/#sec-ordinaryget data-x-internal=ordinaryget>OrdinaryGet</a>(<b>this</b>, <var>P</var>, <var>Receiver</var>).<li><p>Return ? <a href=#crossoriginget-(-o,-p,-receiver-) id=location-get:crossoriginget-(-o,-p,-receiver-)>CrossOriginGet</a>(<b>this</b>, <var>P</var>,
   <var>Receiver</var>).</ol>

  <h5 id=location-set><span class=secno>7.2.4.8</span> [[Set]] ( <var>P</var>, <var>V</var>, <var>Receiver</var> )<a href=#location-set class=self-link></a></h5>

  <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-set:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then return ?
   <a id=location-set:ordinaryset href=https://tc39.es/ecma262/#sec-ordinaryset data-x-internal=ordinaryset>OrdinarySet</a>(<b>this</b>, <var>P</var>, <var>V</var>, <var>Receiver</var>).<li><p>Return ? <a href=#crossoriginset-(-o,-p,-v,-receiver-) id=location-set:crossoriginset-(-o,-p,-v,-receiver-)>CrossOriginSet</a>(<b>this</b>, <var>P</var>, <var>V</var>,
   <var>Receiver</var>).</ol>

  <h5 id=location-delete><span class=secno>7.2.4.9</span> [[Delete]] ( <var>P</var> )<a href=#location-delete class=self-link></a></h5>

  <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-delete:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then return ?
   <a id=location-delete:ordinarydelete href=https://tc39.es/ecma262/#sec-ordinarydelete data-x-internal=ordinarydelete>OrdinaryDelete</a>(<b>this</b>, <var>P</var>).<li><p>Throw a <a id=location-delete:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=location-delete:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

  <h5 id=location-ownpropertykeys><span class=secno>7.2.4.10</span> [[OwnPropertyKeys]] ( )<a href=#location-ownpropertykeys class=self-link></a></h5>

  <ol><li><p>If <a href=#isplatformobjectsameorigin-(-o-) id=location-ownpropertykeys:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin</a>(<b>this</b>) is true, then return
   <a id=location-ownpropertykeys:ordinaryownpropertykeys href=https://tc39.es/ecma262/#sec-ordinaryownpropertykeys data-x-internal=ordinaryownpropertykeys>OrdinaryOwnPropertyKeys</a>(<b>this</b>).<li><p>Return <a href=#crossoriginownpropertykeys-(-o-) id=location-ownpropertykeys:crossoriginownpropertykeys-(-o-)>CrossOriginOwnPropertyKeys</a>(<b>this</b>).</ol>

  


  <h4 id=the-history-interface><span class=secno>7.2.5</span> The <code id=the-history-interface:history-3><a href=#history-3>History</a></code> interface<a href=#the-history-interface class=self-link></a></h4><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History title="The History interface allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in.">History</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/history title="The Window.history read-only property returns a reference to the History object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in).">Window/history</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>3+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>10.1+</span></span></div></div></div>

  <pre><code class='idl'><c- b>enum</c-> <dfn id='scrollrestoration' data-dfn-type='enum'><c- g>ScrollRestoration</c-></dfn> { <c- s>&quot;</c-><a href='browsing-the-web.html#dom-scrollrestoration-auto' id='the-history-interface:dom-scrollrestoration-auto'><c- s>auto</c-></a><c- s>&quot;</c->, <c- s>&quot;</c-><a href='browsing-the-web.html#dom-scrollrestoration-manual' id='the-history-interface:dom-scrollrestoration-manual'><c- s>manual</c-></a><c- s>&quot;</c-> };

[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='history-3' data-dfn-type='interface'><c- g>History</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>unsigned</c-> <c- b>long</c-> <a href='#dom-history-length' id='the-history-interface:dom-history-length'><c- g>length</c-></a>;
  <c- b>attribute</c-> <a href='#scrollrestoration' id='the-history-interface:scrollrestoration'><c- n>ScrollRestoration</c-></a> <a href='#dom-history-scroll-restoration' id='the-history-interface:dom-history-scroll-restoration'><c- g>scrollRestoration</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>any</c-> <a href='#dom-history-state' id='the-history-interface:dom-history-state'><c- g>state</c-></a>;
  <c- b>undefined</c-> <a href='#dom-history-go' id='the-history-interface:dom-history-go'><c- g>go</c-></a>(<c- b>optional</c-> <c- b>long</c-> <c- g>delta</c-> = 0);
  <c- b>undefined</c-> <a href='#dom-history-back' id='the-history-interface:dom-history-back'><c- g>back</c-></a>();
  <c- b>undefined</c-> <a href='#dom-history-forward' id='the-history-interface:dom-history-forward'><c- g>forward</c-></a>();
  <c- b>undefined</c-> <a href='#dom-history-pushstate' id='the-history-interface:dom-history-pushstate'><c- g>pushState</c-></a>(<c- b>any</c-> <c- g>data</c->, <c- b>DOMString</c-> <c- g>unused</c->, <c- b>optional</c-> <c- b>USVString</c->? <c- g>url</c-> = <c- b>null</c->);
  <c- b>undefined</c-> <a href='#dom-history-replacestate' id='the-history-interface:dom-history-replacestate'><c- g>replaceState</c-></a>(<c- b>any</c-> <c- g>data</c->, <c- b>DOMString</c-> <c- g>unused</c->, <c- b>optional</c-> <c- b>USVString</c->? <c- g>url</c-> = <c- b>null</c->);
};</code></pre>

  <dl class=domintro><dt><code><a href=#dom-history id=dom-history-dev>history</a>.<a href=#dom-history-length id=dom-history-length-dev>length</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/length title="The History.length read-only property returns an integer representing the number of elements in the session history, including the currently loaded page.">History/length</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the number of overall <a href=document-sequences.html#tn-session-history-entries id=the-history-interface:tn-session-history-entries>session history
   entries</a> for the current <a id=the-history-interface:traversable-navigable href=document-sequences.html#traversable-navigable>traversable navigable</a>.<dt><code><a href=#dom-history id=the-history-interface:dom-history>history</a>.<a href=#dom-history-scroll-restoration id=dom-history-scroll-restoration-dev>scrollRestoration</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration title="The scrollRestoration property of History interface allows web applications to explicitly set default scroll restoration behavior on history navigation.">History/scrollRestoration</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>46+</span></span><span class="safari yes"><span>Safari</span><span>11+</span></span><span class="chrome yes"><span>Chrome</span><span>46+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge unknown"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd><p>Returns the <a href=browsing-the-web.html#she-scroll-restoration-mode id=the-history-interface:she-scroll-restoration-mode>scroll restoration mode</a> of
   the <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry>active session history entry</a>.<dt><code><a href=#dom-history id=the-history-interface:dom-history-2>history</a>.<a href=#dom-history-scroll-restoration id=the-history-interface:dom-history-scroll-restoration-2>scrollRestoration</a> = <var>value</var></code><dd><p>Set the <a href=browsing-the-web.html#she-scroll-restoration-mode id=the-history-interface:she-scroll-restoration-mode-2>scroll restoration mode</a> of the
   <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-2>active session history entry</a> to
   <var>value</var>.<dt><code><a href=#dom-history id=the-history-interface:dom-history-3>history</a>.<a href=#dom-history-state id=dom-history-state-dev>state</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/state title="The History.state property returns a value representing the state at the top of the history stack. This is a way to look at the state without having to wait for a popstate event.">History/state</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>19+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns the <a href=browsing-the-web.html#she-classic-history-api-state id=the-history-interface:she-classic-history-api-state>classic history API state</a>
   of the <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-3>active session history entry</a>, deserialized
   into a JavaScript value.<dt><code><a href=#dom-history id=the-history-interface:dom-history-4>history</a>.<a href=#dom-history-go id=the-history-interface:dom-history-go-2>go</a>()</code><dd><p>Reloads the current page.<dt><code><a href=#dom-history id=the-history-interface:dom-history-5>history</a>.<a href=#dom-history-go id=dom-history-go-dev>go</a>(<var>delta</var>)</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/go title="The History.go() method loads a specific page from the session history. You can use it to move forwards and backwards through the history depending on the value of a parameter.">History/go</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Goes back or forward the specified number of steps in the overall <a href=document-sequences.html#tn-session-history-entries id=the-history-interface:tn-session-history-entries-2>session history entries</a> list for the current
    <a id=the-history-interface:traversable-navigable-2 href=document-sequences.html#traversable-navigable>traversable navigable</a>.</p>

    <p>A zero delta will reload the current page.</p>

    <p>If the delta is out of range, does nothing.</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-6>history</a>.<a href=#dom-history-back id=dom-history-back-dev>back</a>()</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/back title="The History.back() method causes the browser to move back one page in the session history.">History/back</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Goes back one step in the overall <a href=document-sequences.html#tn-session-history-entries id=the-history-interface:tn-session-history-entries-3>session history
    entries</a> list for the current <a id=the-history-interface:traversable-navigable-3 href=document-sequences.html#traversable-navigable>traversable navigable</a>.</p>

    <p>If there is no previous page, does nothing.</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-7>history</a>.<a href=#dom-history-forward id=dom-history-forward-dev>forward</a>()</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/forward title="The History.forward() method causes the browser to move forward one page in the session history. It has the same effect as calling history.go(1).">History/forward</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1+</span></span><span class="safari yes"><span>Safari</span><span>1+</span></span><span class="chrome yes"><span>Chrome</span><span>1+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Goes forward one step in the overall <a href=document-sequences.html#tn-session-history-entries id=the-history-interface:tn-session-history-entries-4>session
    history entries</a> list for the current <a id=the-history-interface:traversable-navigable-4 href=document-sequences.html#traversable-navigable>traversable navigable</a>.</p>

    <p>If there is no next page, does nothing.</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-8>history</a>.<a href=#dom-history-pushstate id=dom-history-pushstate-dev>pushState</a>(<var>data</var>, "")</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/pushState title="In an HTML document, the history.pushState() method adds an entry to the browser's session history stack.">History/pushState</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>5+</span></span><hr><span class="opera yes"><span>Opera</span><span>11.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>4+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>11.5+</span></span></div></div></div><dd>
    <p>Adds a new entry into session history with its <a href=browsing-the-web.html#she-classic-history-api-state id=the-history-interface:she-classic-history-api-state-2>classic history API state</a> set to a serialization
    of <var>data</var>. The <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-4>active history entry</a>'s
    <a href=browsing-the-web.html#she-url id=the-history-interface:she-url>URL</a> will be copied over and used for the new entry's URL.</p>

    <p>(The second parameter exists for historical reasons, and cannot be omitted; passing the
    empty string is traditional.)</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-9>history</a>.<a href=#dom-history-pushstate id=the-history-interface:dom-history-pushstate-2>pushState</a>(<var>data</var>, "", <var>url</var>)</code><dd>
    <p>Adds a new entry into session history with its <a href=browsing-the-web.html#she-classic-history-api-state id=the-history-interface:she-classic-history-api-state-3>classic history API state</a> set to a serialization
    of <var>data</var>, and with its <a href=browsing-the-web.html#she-url id=the-history-interface:she-url-2>URL</a> set to <var>url</var>.</p>

    <p>If the current <code id=the-history-interface:document><a href=dom.html#document>Document</a></code> <a href=#can-have-its-url-rewritten id=the-history-interface:can-have-its-url-rewritten>cannot have
    its URL rewritten</a> to <var>url</var>, a <a id=the-history-interface:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
    <code id=the-history-interface:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> will be thrown.</p>

    <p>(The second parameter exists for historical reasons, and cannot be omitted; passing the
    empty string is traditional.)</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-10>history</a>.<a href=#dom-history-replacestate id=dom-history-replacestate-dev>replaceState</a>(<var>data</var>, "")</code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState title="The History.replaceState() method modifies the current history entry, replacing it with the state object and URL passed in the method parameters. This method is particularly useful when you want to update the state object or URL of the current history entry in response to some user action.">History/replaceState</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>5+</span></span><hr><span class="opera yes"><span>Opera</span><span>11.5+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>4+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>11.5+</span></span></div></div></div><dd>
    <p>Updates the <a href=browsing-the-web.html#she-classic-history-api-state id=the-history-interface:she-classic-history-api-state-4>classic history API state</a> of
    the <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-5>active session history entry</a> to a structured
    clone of <var>data</var>.</p>

    <p>(The second parameter exists for historical reasons, and cannot be omitted; passing the
    empty string is traditional.)</p>
   <dt><code><a href=#dom-history id=the-history-interface:dom-history-11>history</a>.<a href=#dom-history-replacestate id=the-history-interface:dom-history-replacestate-2>replaceState</a>(<var>data</var>, "", <var>url</var>)</code><dd>
    <p>Updates the <a href=browsing-the-web.html#she-classic-history-api-state id=the-history-interface:she-classic-history-api-state-5>classic history API state</a> of
    the <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-6>active session history entry</a> to a structured
    clone of <var>data</var>, and its <a href=browsing-the-web.html#she-url id=the-history-interface:she-url-3>URL</a> to <var>url</var>.</p>

    <p>If the current <code id=the-history-interface:document-2><a href=dom.html#document>Document</a></code> <a href=#can-have-its-url-rewritten id=the-history-interface:can-have-its-url-rewritten-2>cannot have
    its URL rewritten</a> to <var>url</var>, a <a id=the-history-interface:securityerror-2 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
    <code id=the-history-interface:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> will be thrown.</p>

    <p>(The second parameter exists for historical reasons, and cannot be omitted; passing the
    empty string is traditional.)</p>
   </dl>

  

  <p>A <code id=the-history-interface:document-3><a href=dom.html#document>Document</a></code> has a <dfn id=doc-history>history object</dfn>, a
  <code id=the-history-interface:history-3-2><a href=#history-3>History</a></code> object.</p>

  <p>The <dfn data-dfn-for=Window id=dom-history data-dfn-type=attribute><code>history</code></dfn> getter steps
  are to return <a id=the-history-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-document-window id=the-history-interface:concept-document-window>associated
  <code>Document</code></a>'s <a href=#doc-history id=the-history-interface:doc-history>history object</a>.</p>

  <hr>

  <p>Each <code id=the-history-interface:history-3-3><a href=#history-3>History</a></code> object has <dfn id=concept-history-state>state</dfn>,
  initially null.</p>

  <p>Each <code id=the-history-interface:history-3-4><a href=#history-3>History</a></code> object has a <dfn id=concept-history-length>length</dfn>, a
  non-negative integer, initially 0.</p>

  <p>Each <code id=the-history-interface:history-3-5><a href=#history-3>History</a></code> object has an <dfn id=concept-history-index>index</dfn>, a
  non-negative integer, initially 0.</p>

  <p class=note>Although the <a href=#concept-history-index id=the-history-interface:concept-history-index>index</a> is not directly
  exposed, it can be inferred from changes to the <a href=#concept-history-length id=the-history-interface:concept-history-length>length</a> during synchronous navigations. In fact, that is
  what it's used for.</p>

  <p>The <dfn data-dfn-for=History id=dom-history-length data-dfn-type=attribute><code>length</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-history-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-history-interface:concept-document-window-2>associated <code>Document</code></a> is not <a id=the-history-interface:fully-active href=document-sequences.html#fully-active>fully
   active</a>, then throw a <a id=the-history-interface:securityerror-3 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-history-interface:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return <a id=the-history-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-history-length id=the-history-interface:concept-history-length-2>length</a>.</ol>

  <p>The <dfn data-dfn-for=History id=dom-history-scroll-restoration data-dfn-type=attribute><code>scrollRestoration</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-history-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-history-interface:concept-document-window-3>associated <code>Document</code></a> is not <a id=the-history-interface:fully-active-2 href=document-sequences.html#fully-active>fully
   active</a>, then throw a <a id=the-history-interface:securityerror-4 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-history-interface:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return <a id=the-history-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-navigable id=the-history-interface:window-navigable>navigable</a>'s <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-7>active session history
   entry</a>'s <a href=browsing-the-web.html#she-scroll-restoration-mode id=the-history-interface:she-scroll-restoration-mode-3>scroll restoration
   mode</a>.</ol>

  <p>The <code id=the-history-interface:dom-history-scroll-restoration-3><a href=#dom-history-scroll-restoration>scrollRestoration</a></code> setter steps
  are:</p>

  <ol><li><p>If <a id=the-history-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-history-interface:concept-document-window-4>associated <code>Document</code></a> is not <a id=the-history-interface:fully-active-3 href=document-sequences.html#fully-active>fully
   active</a>, then throw a <a id=the-history-interface:securityerror-5 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-history-interface:domexception-5><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Set <a id=the-history-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global-5 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-navigable id=the-history-interface:window-navigable-2>navigable</a>'s <a href=document-sequences.html#nav-active-history-entry id=the-history-interface:nav-active-history-entry-8>active session history
   entry</a>'s <a href=browsing-the-web.html#she-scroll-restoration-mode id=the-history-interface:she-scroll-restoration-mode-4>scroll restoration mode</a> to the
   given value.</ol>

  <p>The <dfn data-dfn-for=History id=dom-history-state data-dfn-type=attribute><code>state</code></dfn> getter
  steps are:</p>

  <ol><li><p>If <a id=the-history-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-history-interface:concept-relevant-global-6 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-history-interface:concept-document-window-5>associated <code>Document</code></a> is not <a id=the-history-interface:fully-active-4 href=document-sequences.html#fully-active>fully
   active</a>, then throw a <a id=the-history-interface:securityerror-6 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-history-interface:domexception-6><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return <a id=the-history-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-history-state id=the-history-interface:concept-history-state>state</a>.</ol>

  <p>The <dfn data-dfn-for=History id=dom-history-go data-dfn-type=method><code>go(<var>delta</var>)</code></dfn>
  method steps are to <a href=#delta-traverse id=the-history-interface:delta-traverse>delta traverse</a> <a id=the-history-interface:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> given <var>delta</var>.</p>

  <p>The <dfn data-dfn-for=History id=dom-history-back data-dfn-type=method><code>back()</code></dfn> method steps
  are to <a href=#delta-traverse id=the-history-interface:delta-traverse-2>delta traverse</a> <a id=the-history-interface:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> given −1.</p>

  <p>The <dfn data-dfn-for=History id=dom-history-forward data-dfn-type=method><code>forward()</code></dfn> method
  steps are to <a href=#delta-traverse id=the-history-interface:delta-traverse-3>delta traverse</a> <a id=the-history-interface:this-12 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> given +1.</p>

  <p>To <dfn id=delta-traverse>delta traverse</dfn> a <code id=the-history-interface:history-3-6><a href=#history-3>History</a></code> object <var>history</var> given an integer
  <var>delta</var>:</p>

  <ol><li><p>Let <var>document</var> be <var>history</var>'s <a id=the-history-interface:concept-relevant-global-7 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#concept-document-window id=the-history-interface:concept-document-window-6>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=the-history-interface:fully-active-5 href=document-sequences.html#fully-active>fully active</a>, then throw a
   <a id=the-history-interface:securityerror-7 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-history-interface:domexception-7><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>delta</var> is 0, then <a id=the-history-interface:reload href=browsing-the-web.html#reload>reload</a> <var>document</var>'s <a id=the-history-interface:node-navigable href=document-sequences.html#node-navigable>node
   navigable</a>, and return.<li><p><a id=the-history-interface:traverse-the-history-by-a-delta href=browsing-the-web.html#traverse-the-history-by-a-delta>Traverse the history by a delta</a> given <var>document</var>'s <a id=the-history-interface:node-navigable-2 href=document-sequences.html#node-navigable>node
   navigable</a>'s <a href=document-sequences.html#nav-traversable id=the-history-interface:nav-traversable>traversable navigable</a>, <var>delta</var>,
   and with <i id=the-history-interface:traverse-sourcedocument><a href=browsing-the-web.html#traverse-sourcedocument>sourceDocument</a></i> set to
   <var>document</var>.</ol>

  <p>The <dfn data-dfn-for=History id=dom-history-pushstate data-dfn-type=method><code>pushState(<var>data</var>,
  <var>unused</var>, <var>url</var>)</code></dfn> method steps are to run the <a href=#shared-history-push/replace-state-steps id=the-history-interface:shared-history-push/replace-state-steps>shared history
  push/replace state steps</a> given <a id=the-history-interface:this-13 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, <var>data</var>, <var>url</var>, and
  "<code id=the-history-interface:navigationhistorybehavior-push><a href=browsing-the-web.html#navigationhistorybehavior-push>push</a></code>".</p>

  <p>The <dfn data-dfn-for=History id=dom-history-replacestate data-dfn-type=method><code>replaceState(<var>data</var>, <var>unused</var>,
  <var>url</var>)</code></dfn> method steps are to run the <a href=#shared-history-push/replace-state-steps id=the-history-interface:shared-history-push/replace-state-steps-2>shared history push/replace state
  steps</a> given <a id=the-history-interface:this-14 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, <var>data</var>, <var>url</var>, and "<code id=the-history-interface:navigationhistorybehavior-replace><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>".</p>

  <p>The <dfn id=shared-history-push/replace-state-steps>shared history push/replace state steps</dfn>, given a <code id=the-history-interface:history-3-7><a href=#history-3>History</a></code>
  <var>history</var>, a value <var>data</var>, a <a id=the-history-interface:scalar-value-string href=https://infra.spec.whatwg.org/#scalar-value-string data-x-internal=scalar-value-string>scalar value string</a>-or-null
  <var>url</var>, and a <a id=the-history-interface:history-handling-behavior href=browsing-the-web.html#history-handling-behavior>history handling behavior</a> <var>historyHandling</var>, are:</p>

  <ol><li><p>Let <var>document</var> be <var>history</var>'s <a id=the-history-interface:concept-relevant-global-8 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#concept-document-window id=the-history-interface:concept-document-window-7>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=the-history-interface:fully-active-6 href=document-sequences.html#fully-active>fully active</a>, then throw a
   <a id=the-history-interface:securityerror-8 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-history-interface:domexception-8><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Optionally, throw a <a id=the-history-interface:securityerror-9 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-history-interface:domexception-9><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.
   (For example, the user agent might disallow calls to these methods that are invoked on a timer,
   or from event listeners that are not triggered in response to a clear user action, or that are
   invoked in rapid succession.)<li><p>Let <var>serializedData</var> be
   <a id=the-history-interface:structuredserializeforstorage href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(<var>data</var>). Rethrow any exceptions.<li><p>Let <var>newURL</var> be <var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-history-interface:the-document's-address" data-x-internal="the-document's-address">URL</a>.<li>
    <p>If <var>url</var> is not null or the empty string, then:</p>

    <ol><li><p>Set <var>newURL</var> to the result of <a id=the-history-interface:encoding-parsing-a-url href=urls-and-fetching.html#encoding-parsing-a-url>encoding-parsing a URL</a> given
     <var>url</var>, relative to the <a id=the-history-interface:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings object</a> of
     <var>history</var>.<li><p>If <var>newURL</var> is failure, then throw a <a id=the-history-interface:securityerror-10 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
     <code id=the-history-interface:domexception-10><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>document</var> <a href=#can-have-its-url-rewritten id=the-history-interface:can-have-its-url-rewritten-3>cannot have its URL
     rewritten</a> to <var>newURL</var>, then throw a <a id=the-history-interface:securityerror-11 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
     <code id=the-history-interface:domexception-11><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>

    <p class=note>The special case for the empty string here is historical, and leads to
    different resulting URLs when comparing code such as <code>location.href = ""</code>
    (which performs URL parsing on the empty string) versus <code>history.pushState(null, "", "")</code> (which bypasses it).</p>
   <li><p>Let <var>navigation</var> be <var>history</var>'s <a id=the-history-interface:concept-relevant-global-9 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#window-navigation-api id=the-history-interface:window-navigation-api>navigation API</a>.<li><p>Let <var>continue</var> be the result of <a href=#fire-a-push/replace/reload-navigate-event id=the-history-interface:fire-a-push/replace/reload-navigate-event>firing a push/replace/reload <code>navigate</code> event</a> at
   <var>navigation</var> with <i id=the-history-interface:fire-navigate-prr-navigationtype><a href=#fire-navigate-prr-navigationtype>navigationType</a></i> set to
   <var>historyHandling</var>, <i id=the-history-interface:fire-navigate-prr-issamedocument><a href=#fire-navigate-prr-issamedocument>isSameDocument</a></i> set
   to true, <i id=the-history-interface:fire-navigate-prr-destinationurl><a href=#fire-navigate-prr-destinationurl>destinationURL</a></i> set to
   <var>newURL</var>, and <i id=the-history-interface:fire-navigate-prr-classichistoryapistate><a href=#fire-navigate-prr-classichistoryapistate>classicHistoryAPIState</a></i> set to
   <var>serializedData</var>.<li><p>If <var>continue</var> is false, then return.</p>

   <li><p>Run the <a id=the-history-interface:url-and-history-update-steps href=browsing-the-web.html#url-and-history-update-steps>URL and history update steps</a> given <var>document</var> and
   <var>newURL</var>, with <i id=the-history-interface:uhus-serializeddata><a href=browsing-the-web.html#uhus-serializeddata>serializedData</a></i> set to
   <var>serializedData</var> and <i id=the-history-interface:uhus-historyhandling><a href=browsing-the-web.html#uhus-historyhandling>historyHandling</a></i> set to
   <var>historyHandling</var>.</ol>

  <p>User agents may limit the number of state objects added to the session history per page. If a
  page hits the <a id=the-history-interface:implementation-defined href=https://infra.spec.whatwg.org/#implementation-defined data-x-internal=implementation-defined>implementation-defined</a> limit, user agents must remove the entry
  immediately after the first entry for that <code id=the-history-interface:document-4><a href=dom.html#document>Document</a></code> object in the session history
  after having added the new entry. (Thus the state history acts as a FIFO buffer for eviction, but
  as a LIFO buffer for navigation.)</p>

  <p>A <code id=the-history-interface:document-5><a href=dom.html#document>Document</a></code> <var>document</var> <dfn id=can-have-its-url-rewritten>can have its URL rewritten</dfn> to a
  <a id=the-history-interface:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> <var>targetURL</var> if the following algorithm returns true:</p>

  <ol><li><p>Let <var>documentURL</var> be <var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-history-interface:the-document's-address-2" data-x-internal="the-document's-address">URL</a>.<li><p>If <var>targetURL</var> and <var>documentURL</var> differ in their <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-history-interface:concept-url-scheme data-x-internal=concept-url-scheme>scheme</a>, <a href=https://url.spec.whatwg.org/#concept-url-username id=the-history-interface:concept-url-username data-x-internal=concept-url-username>username</a>,
   <a href=https://url.spec.whatwg.org/#concept-url-password id=the-history-interface:concept-url-password data-x-internal=concept-url-password>password</a>, <a href=https://url.spec.whatwg.org/#concept-url-host id=the-history-interface:concept-url-host data-x-internal=concept-url-host>host</a>, or <a href=https://url.spec.whatwg.org/#concept-url-port id=the-history-interface:concept-url-port data-x-internal=concept-url-port>port</a>
   components, then return false.<li>
    <p>If <var>targetURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-history-interface:concept-url-scheme-2 data-x-internal=concept-url-scheme>scheme</a> is an
    <a id=the-history-interface:http(s)-scheme href=https://fetch.spec.whatwg.org/#http-scheme data-x-internal=http(s)-scheme>HTTP(S) scheme</a>, then return true.</p>

    <p class=note>Differences in <a href=https://url.spec.whatwg.org/#concept-url-path id=the-history-interface:concept-url-path data-x-internal=concept-url-path>path</a>, <a href=https://url.spec.whatwg.org/#concept-url-query id=the-history-interface:concept-url-query data-x-internal=concept-url-query>query</a>, and <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-history-interface:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a> are allowed for <code id=the-history-interface:http-protocol><a data-x-internal=http-protocol href=https://httpwg.org/specs/rfc7230.html#http.uri>http:</a></code> and <code id=the-history-interface:https-protocol><a data-x-internal=https-protocol href=https://httpwg.org/specs/rfc7230.html#https.uri>https:</a></code> URLs.</p>
   <li>
    <p>If <var>targetURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-history-interface:concept-url-scheme-3 data-x-internal=concept-url-scheme>scheme</a> is "<code>file</code>", then:</p>

    <ol><li><p>If <var>targetURL</var> and <var>documentURL</var> differ in their <a href=https://url.spec.whatwg.org/#concept-url-path id=the-history-interface:concept-url-path-2 data-x-internal=concept-url-path>path</a> component, then return false.<li><p>Return true.</ol>

    <p class=note>Differences in <a href=https://url.spec.whatwg.org/#concept-url-query id=the-history-interface:concept-url-query-2 data-x-internal=concept-url-query>query</a> and <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-history-interface:concept-url-fragment-2 data-x-internal=concept-url-fragment>fragment</a> are allowed for <code>file:</code>
    URLs.</p>
   <li>
    <p>If <var>targetURL</var> and <var>documentURL</var> differ in their <a href=https://url.spec.whatwg.org/#concept-url-path id=the-history-interface:concept-url-path-3 data-x-internal=concept-url-path>path</a> component or <a href=https://url.spec.whatwg.org/#concept-url-query id=the-history-interface:concept-url-query-3 data-x-internal=concept-url-query>query</a> components, then return false.</p>

    <p class=note>Only differences in <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-history-interface:concept-url-fragment-3 data-x-internal=concept-url-fragment>fragment</a> are
    allowed for other types of URLs.</p>
   <li><p>Return true.</ol>

  

  <div class=example>
   <table><thead><tr><th><var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-history-interface:the-document's-address-3" data-x-internal="the-document's-address">URL</a>
      <th><var>targetURL</var>
      <th><a href=#can-have-its-url-rewritten id=can-have-its-url-rewritten-dev>can have its URL rewritten</a>
    <tbody><tr><td><code>https://example.com/home</code>
      <td><code>https://example.com/home#about</code>
      <td>✅
     <tr><td><code>https://example.com/home</code>
      <td><code>https://example.com/home?page=shop</code>
      <td>✅
     <tr><td><code>https://example.com/home</code>
      <td><code>https://example.com/shop</code>
      <td>✅
     <tr><td><code>https://example.com/home</code>
      <td><code>https://user:pass@example.com/home</code>
      <td>❌
     <tr><td><code>https://example.com/home</code>
      <td><code>http://example.com/home</code>
      <td>❌
     <tr><td><code>file:///path/to/x</code>
      <td><code>file:///path/to/x#hash</code>
      <td>✅
     <tr><td><code>file:///path/to/x</code>
      <td><code>file:///path/to/x?search</code>
      <td>✅
     <tr><td><code>file:///path/to/x</code>
      <td><code>file:///path/to/y</code>
      <td>❌
     <tr><td><code>about:blank</code>
      <td><code>about:blank#hash</code>
      <td>✅
     <tr><td><code>about:blank</code>
      <td><code>about:blank?search</code>
      <td>❌
     <tr><td><code>about:blank</code>
      <td><code>about:srcdoc</code>
      <td>❌
     <tr><td><code>data:text/html,foo</code>
      <td><code>data:text/html,foo#hash</code>
      <td>✅
     <tr><td><code>data:text/html,foo</code>
      <td><code>data:text/html,foo?search</code>
      <td>❌
     <tr><td><code>data:text/html,foo</code>
      <td><code>data:text/html,bar</code>
      <td>❌
     <tr><td><code>data:text/html,foo</code>
      <td><code>data:bar</code>
      <td>❌
     <tr><td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43</code>
      <td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43#hash</code>
      <td>✅
     <tr><td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43</code>
      <td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43?search</code>
      <td>❌
     <tr><td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43</code>
      <td><code>blob:https://example.com/anything</code>
      <td>❌
     <tr><td><code>blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43</code>
      <td><code>blob:path</code>
      <td>❌
   </table>

   <p>Note how only the <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-history-interface:the-document's-address-4" data-x-internal="the-document's-address">URL</a> of the <code id=the-history-interface:document-6><a href=dom.html#document>Document</a></code>
   matters, and not its <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-history-interface:concept-document-origin data-x-internal=concept-document-origin>origin</a>. They can mismatch in
   cases like <code id=the-history-interface:about:blank><a href=infrastructure.html#about:blank>about:blank</a></code> <code id=the-history-interface:document-7><a href=dom.html#document>Document</a></code>s with inherited origins, in sandboxed
   <code id=the-history-interface:the-iframe-element><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>s, or when the <code id=the-history-interface:dom-document-domain><a href=browsers.html#dom-document-domain>document.domain</a></code>
   setter has been used.</p>
  </div>

  <div class=example>

   <p>Consider a game where the user can navigate along a line, such that the user is always at some
   coordinate, and such that the user can bookmark the page corresponding to a particular
   coordinate, to return to it later.</p>

   <p>A static page implementing the x=5 position in such a game could look like the following:</p>

   <pre><code class='html'><c- cp>&lt;!DOCTYPE HTML&gt;</c->
<c- c>&lt;!-- this is https://example.com/line?x=5 --&gt;</c->
<c- p>&lt;</c-><c- f>html</c-> <c- e>lang</c-><c- o>=</c-><c- s>&quot;en&quot;</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>title</c-><c- p>&gt;</c->Line Game - 5<c- p>&lt;/</c-><c- f>title</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>p</c-><c- p>&gt;</c->You are at coordinate 5 on the line.<c- p>&lt;/</c-><c- f>p</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>p</c-><c- p>&gt;</c->
 <c- p>&lt;</c-><c- f>a</c-> <c- e>href</c-><c- o>=</c-><c- s>&quot;?x=6&quot;</c-><c- p>&gt;</c->Advance to 6<c- p>&lt;/</c-><c- f>a</c-><c- p>&gt;</c-> or
 <c- p>&lt;</c-><c- f>a</c-> <c- e>href</c-><c- o>=</c-><c- s>&quot;?x=4&quot;</c-><c- p>&gt;</c->retreat to 4<c- p>&lt;/</c-><c- f>a</c-><c- p>&gt;</c->?
<c- p>&lt;/</c-><c- f>p</c-><c- p>&gt;</c-></code></pre>

   <p>The problem with such a system is that each time the user clicks, the whole page has to be
   reloaded. Here instead is another way of doing it, using script:</p>

   <pre><code class='html'><c- cp>&lt;!DOCTYPE HTML&gt;</c->
<c- c>&lt;!-- this starts off as https://example.com/line?x=5 --&gt;</c->
<c- p>&lt;</c-><c- f>html</c-> <c- e>lang</c-><c- o>=</c-><c- s>&quot;en&quot;</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>title</c-><c- p>&gt;</c->Line Game - 5<c- p>&lt;/</c-><c- f>title</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>p</c-><c- p>&gt;</c->You are at coordinate <c- p>&lt;</c-><c- f>span</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;coord&quot;</c-><c- p>&gt;</c->5<c- p>&lt;/</c-><c- f>span</c-><c- p>&gt;</c-> on the line.<c- p>&lt;/</c-><c- f>p</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>p</c-><c- p>&gt;</c->
 <c- p>&lt;</c-><c- f>a</c-> <c- e>href</c-><c- o>=</c-><c- s>&quot;?x=6&quot;</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;go(1); return false;&quot;</c-><c- p>&gt;</c->Advance to 6<c- p>&lt;/</c-><c- f>a</c-><c- p>&gt;</c-> or
 <c- p>&lt;</c-><c- f>a</c-> <c- e>href</c-><c- o>=</c-><c- s>&quot;?x=4&quot;</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;go(-1); return false;&quot;</c-><c- p>&gt;</c->retreat to 4<c- p>&lt;/</c-><c- f>a</c-><c- p>&gt;</c->?
<c- p>&lt;/</c-><c- f>p</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>script</c-><c- p>&gt;</c->
 <c- a>var</c-> currentPage <c- o>=</c-> <c- mf>5</c-><c- p>;</c-> <c- c1>// prefilled by server</c->
 <c- a>function</c-> go<c- p>(</c->d<c- p>)</c-> <c- p>{</c->
   setupPage<c- p>(</c->currentPage <c- o>+</c-> d<c- p>);</c->
   history<c- p>.</c->pushState<c- p>(</c->currentPage<c- p>,</c-> <c- u>&quot;&quot;</c-><c- p>,</c-> <c- t>&apos;?x=&apos;</c-> <c- o>+</c-> currentPage<c- p>);</c->
 <c- p>}</c->
 onpopstate <c- o>=</c-> <c- a>function</c-><c- p>(</c->event<c- p>)</c-> <c- p>{</c->
   setupPage<c- p>(</c->event<c- p>.</c->state<c- p>);</c->
 <c- p>}</c->
 <c- a>function</c-> setupPage<c- p>(</c->page<c- p>)</c-> <c- p>{</c->
   currentPage <c- o>=</c-> page<c- p>;</c->
   document<c- p>.</c->title <c- o>=</c-> <c- t>&apos;Line Game - &apos;</c-> <c- o>+</c-> currentPage<c- p>;</c->
   document<c- p>.</c->getElementById<c- p>(</c-><c- t>&apos;coord&apos;</c-><c- p>).</c->textContent <c- o>=</c-> currentPage<c- p>;</c->
   document<c- p>.</c->links<c- p>[</c-><c- mf>0</c-><c- p>].</c->href <c- o>=</c-> <c- t>&apos;?x=&apos;</c-> <c- o>+</c-> <c- p>(</c->currentPage<c- o>+</c-><c- mf>1</c-><c- p>);</c->
   document<c- p>.</c->links<c- p>[</c-><c- mf>0</c-><c- p>].</c->textContent <c- o>=</c-> <c- t>&apos;Advance to &apos;</c-> <c- o>+</c-> <c- p>(</c->currentPage<c- o>+</c-><c- mf>1</c-><c- p>);</c->
   document<c- p>.</c->links<c- p>[</c-><c- mf>1</c-><c- p>].</c->href <c- o>=</c-> <c- t>&apos;?x=&apos;</c-> <c- o>+</c-> <c- p>(</c->currentPage<c- o>-</c-><c- mf>1</c-><c- p>);</c->
   document<c- p>.</c->links<c- p>[</c-><c- mf>1</c-><c- p>].</c->textContent <c- o>=</c-> <c- t>&apos;retreat to &apos;</c-> <c- o>+</c-> <c- p>(</c->currentPage<c- o>-</c-><c- mf>1</c-><c- p>);</c->
 <c- p>}</c->
<c- p>&lt;/</c-><c- f>script</c-><c- p>&gt;</c-></code></pre>

   <p>In systems without script, this still works like the previous example. However, users that
   <em>do</em> have script support can now navigate much faster, since there is no network access
   for the same experience. Furthermore, contrary to the experience the user would have with just a
   naïve script-based approach, bookmarking and navigating the session history still work.</p>

   <p>In the example above, the <var>data</var> argument to the <code id=the-history-interface:dom-history-pushstate-3><a href=#dom-history-pushstate>pushState()</a></code> method is the same information as would be sent
   to the server, but in a more convenient form, so that the script doesn't have to parse the URL
   each time the user navigates.</p>

  </div>

  <div class=example>
   <p>Most applications want to use the same <a id=the-history-interface:scroll-restoration-mode href=browsing-the-web.html#scroll-restoration-mode>scroll restoration mode</a> value for all of
   their history entries. To achieve this they can set the <code id=the-history-interface:dom-history-scroll-restoration-4><a href=#dom-history-scroll-restoration>scrollRestoration</a></code> attribute as soon as possible
   (e.g., in the first <code id=the-history-interface:the-script-element><a href=scripting.html#the-script-element>script</a></code> element in the document's <code id=the-history-interface:the-head-element><a href=semantics.html#the-head-element>head</a></code> element) to
   ensure that any entry added to the history session gets the desired scroll restoration mode.</p>

   <pre><code class='html'><c- p>&lt;</c-><c- f>head</c-><c- p>&gt;</c->
  <c- p>&lt;</c-><c- f>script</c-><c- p>&gt;</c->
       <c- k>if</c-> <c- p>(</c-><c- t>&apos;scrollRestoration&apos;</c-> <c- k>in</c-> history<c- p>)</c->
            history<c- p>.</c->scrollRestoration <c- o>=</c-> <c- t>&apos;manual&apos;</c-><c- p>;</c->
  <c- p>&lt;/</c-><c- f>script</c-><c- p>&gt;</c->
<c- p>&lt;/</c-><c- f>head</c-><c- p>&gt;</c->
   </code></pre>
  </div>


  <h4 id=navigation-api><span class=secno>7.2.6</span> The navigation API<a href=#navigation-api class=self-link></a></h4>

  <h5 id=navigation-api-intro><span class=secno>7.2.6.1</span> Introduction<a href=#navigation-api-intro class=self-link></a></h5>

  <p><i>This section is non-normative.</i></p>

  <p>The navigation API, provided by the global <code id=navigation-api-intro:dom-navigation><a href=#dom-navigation>navigation</a></code>
  property, provides a modern and web application-focused way of managing navigations and history entries. It is a successor to the classic <code id=navigation-api-intro:dom-location><a href=#dom-location>location</a></code> and <code id=navigation-api-intro:dom-history><a href=#dom-history>history</a></code> APIs.</p>

  <p>One ability the API provides is inspecting <a href=browsing-the-web.html#session-history-entry id=navigation-api-intro:session-history-entry>session history entries</a>. For example, the following will display the entries' URLs in an ordered list:</p>

  <pre><code class='js'><c- a>const</c-> ol <c- o>=</c-> document<c- p>.</c->createElement<c- p>(</c-><c- u>&quot;ol&quot;</c-><c- p>);</c->
ol<c- p>.</c->start <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> <c- c1>// so that the list items&apos; ordinal values match up with the entry indices</c->

<c- k>for</c-> <c- p>(</c-><c- a>const</c-> entry <c- k>of</c-> navigation<c- p>.</c->entries<c- p>())</c-> <c- p>{</c->
  <c- a>const</c-> li <c- o>=</c-> document<c- p>.</c->createElement<c- p>(</c-><c- u>&quot;li&quot;</c-><c- p>);</c->

  <c- k>if</c-> <c- p>(</c->entry<c- p>.</c->index <c- o>&lt;</c-> navigation<c- p>.</c->currentEntry<c- p>.</c->index<c- p>)</c-> <c- p>{</c->
    li<c- p>.</c->className <c- o>=</c-> <c- u>&quot;backward&quot;</c-><c- p>;</c->
  <c- p>}</c-> <c- k>else</c-> <c- k>if</c-> <c- p>(</c->entry<c- p>.</c->index <c- o>&gt;</c-> navigation<c- p>.</c->currentEntry<c- p>.</c->index<c- p>)</c-> <c- p>{</c->
    li<c- p>.</c->className <c- o>=</c-> <c- u>&quot;forward&quot;</c-><c- p>;</c->
  <c- p>}</c-> <c- k>else</c-> <c- p>{</c->
    li<c- p>.</c->className <c- o>=</c-> <c- u>&quot;current&quot;</c-><c- p>;</c->
  <c- p>}</c->

  li<c- p>.</c->textContent <c- o>=</c-> entry<c- p>.</c->url<c- p>;</c->
  ol<c- p>.</c->append<c- p>(</c->li<c- p>);</c->
<c- p>}</c-></code></pre>

  <p>The <code id=navigation-api-intro:dom-navigation-entries><a href=#dom-navigation-entries>navigation.entries()</a></code> array contains <code id=navigation-api-intro:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> instances, which have other useful properties in addition to the <code id=navigation-api-intro:dom-navigationhistoryentry-url><a href=#dom-navigationhistoryentry-url>url</a></code> and <code id=navigation-api-intro:dom-navigationhistoryentry-index><a href=#dom-navigationhistoryentry-index>index</a></code> properties shown here. Note that the array only contains <code id=navigation-api-intro:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> objects that represent the current <a id=navigation-api-intro:navigable href=document-sequences.html#navigable>navigable</a>, and thus its contents are not impacted by navigations inside <a href=document-sequences.html#navigable-container id=navigation-api-intro:navigable-container>navigable containers</a> such as <code id=navigation-api-intro:the-iframe-element><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>s, or by navigations of the <a href=document-sequences.html#nav-parent id=navigation-api-intro:nav-parent>parent navigable</a> in cases where the navigation API is itself being used inside an <code id=navigation-api-intro:the-iframe-element-2><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>. Additionally, it only contains <code id=navigation-api-intro:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> objects representing same-<a id=navigation-api-intro:concept-origin href=browsers.html#concept-origin>origin</a> <a href=browsing-the-web.html#session-history-entry id=navigation-api-intro:session-history-entry-2>session history entries</a>, meaning that if the user has visited other origins before or after the current one, there will not be corresponding <code id=navigation-api-intro:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>s.</p>

  <hr>

  <p>The navigation API can also be used to navigate, reload, or traverse through the history:</p>

  <pre><code class='html'><c- p>&lt;</c-><c- f>button</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;navigation.reload()&quot;</c-><c- p>&gt;</c->Reload<c- p>&lt;/</c-><c- f>button</c-><c- p>&gt;</c->

<c- p>&lt;</c-><c- f>input</c-> <c- e>type</c-><c- o>=</c-><c- s>&quot;url&quot;</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;navigationURL&quot;</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>button</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;navigation.navigate(navigationURL.value)&quot;</c-><c- p>&gt;</c->Navigate<c- p>&lt;/</c-><c- f>button</c-><c- p>&gt;</c->

<c- p>&lt;</c-><c- f>button</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;backButton&quot;</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;navigation.back()&quot;</c-><c- p>&gt;</c->Back<c- p>&lt;/</c-><c- f>button</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>button</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;forwardButton&quot;</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;navigation.forward()&quot;</c-><c- p>&gt;</c->Forward<c- p>&lt;/</c-><c- f>button</c-><c- p>&gt;</c->

<c- p>&lt;</c-><c- f>select</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;traversalDestinations&quot;</c-><c- p>&gt;&lt;/</c-><c- f>select</c-><c- p>&gt;</c->
<c- p>&lt;</c-><c- f>button</c-> <c- e>id</c-><c- o>=</c-><c- s>&quot;goButton&quot;</c-> <c- e>onclick</c-><c- o>=</c-><c- s>&quot;navigation.traverseTo(traversalDestinations.value)&quot;</c-><c- p>&gt;</c->Traverse To<c- p>&lt;/</c-><c- f>button</c-><c- p>&gt;</c->

<c- p>&lt;</c-><c- f>script</c-><c- p>&gt;</c->
backButton<c- p>.</c->disabled <c- o>=</c-> <c- o>!</c->navigation<c- p>.</c->canGoBack<c- p>;</c->
forwardButton<c- p>.</c->disabled <c- o>=</c-> <c- o>!</c->navigation<c- p>.</c->canGoForward<c- p>;</c->

<c- k>for</c-> <c- p>(</c-><c- a>const</c-> entry <c- k>of</c-> navigation<c- p>.</c->entries<c- p>())</c-> <c- p>{</c->
  traversalDestinations<c- p>.</c->append<c- p>(</c-><c- k>new</c-> Option<c- p>(</c->entry<c- p>.</c->url<c- p>,</c-> entry<c- p>.</c->key<c- p>));</c->
<c- p>}</c->
<c- p>&lt;/</c-><c- f>script</c-><c- p>&gt;</c-></code></pre>

  <p>Note that traversals are again limited to same-<a id=navigation-api-intro:concept-origin-2 href=browsers.html#concept-origin>origin</a> destinations, meaning that, for example, <code id=navigation-api-intro:dom-navigation-cangoback><a href=#dom-navigation-cangoback>navigation.canGoBack</a></code> will be false if the previous <a id=navigation-api-intro:session-history-entry-3 href=browsing-the-web.html#session-history-entry>session history entry</a> is for a page from another origin.</p>

  <hr>

  <p>The most powerful part of the navigation API is the <code id=navigation-api-intro:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event, which fires whenever almost any navigation or traversal occurs in the current <a id=navigation-api-intro:navigable-2 href=document-sequences.html#navigable>navigable</a>:</p>

  <pre><code class='js'>navigation<c- p>.</c->onnavigate <c- o>=</c-> event <c- p>=&gt;</c-> <c- p>{</c->
  console<c- p>.</c->log<c- p>(</c->event<c- p>.</c->navigationType<c- p>);</c-> <c- c1>// &quot;push&quot;, &quot;replace&quot;, &quot;reload&quot;, or &quot;traverse&quot;</c->
  console<c- p>.</c->log<c- p>(</c->event<c- p>.</c->destination<c- p>.</c->url<c- p>);</c->
  console<c- p>.</c->log<c- p>(</c->event<c- p>.</c->userInitiated<c- p>);</c->
  <c- c1>// ... and </c-><a href='#the-navigateevent-interface'><c- c1>other useful properties</c-></a>
<c- p>};</c-></code></pre>

  <p>(The event will not fire for <a href=speculative-loading.html#nav-traversal-ui>location bar-initiated navigations</a>, or navigations initiated from other windows, when the destination of the navigation is a new document.)</p>

  <p>Much of the time, the event's <code id=navigation-api-intro:dom-event-cancelable><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> property will be true, meaning this event can be canceled using <code id=navigation-api-intro:dom-event-preventdefault><a data-x-internal=dom-event-preventdefault href=https://dom.spec.whatwg.org/#dom-event-preventdefault>preventDefault()</a></code>:</p>

  <pre><code class='js'>navigation<c- p>.</c->onnavigate <c- o>=</c-> event <c- p>=&gt;</c-> <c- p>{</c->
  <c- k>if</c-> <c- p>(</c->event<c- p>.</c->cancelable <c- o>&amp;&amp;</c-> isDisallowedURL<c- p>(</c->event<c- p>.</c->destination<c- p>.</c->url<c- p>))</c-> <c- p>{</c->
    alert<c- p>(</c-><c- sb>`Please don&apos;t go to </c-><c- si>${</c->event<c- p>.</c->destination<c- p>.</c->url<c- si>}</c-><c- sb>!`</c-><c- p>);</c->
    event<c- p>.</c->preventDefault<c- p>();</c->
  <c- p>}</c->
<c- p>};</c->
</code></pre>

  <p>The <code id=navigation-api-intro:dom-event-cancelable-2><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> property will be false for some "<code id=navigation-api-intro:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations, such as those taking place inside <a href=document-sequences.html#child-navigable id=navigation-api-intro:child-navigable>child navigables</a>, those crossing to new origins, or when the user attempts to traverse again shortly after a previous call to <code id=navigation-api-intro:dom-event-preventdefault-2><a data-x-internal=dom-event-preventdefault href=https://dom.spec.whatwg.org/#dom-event-preventdefault>preventDefault()</a></code> prevented them from doing so.</p>

  <p>The <code id=navigation-api-intro:navigateevent><a href=#navigateevent>NavigateEvent</a></code>'s <code id=navigation-api-intro:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>intercept()</a></code> method allows intercepting a navigation and converting it into a same-document navigation:</p>

  <pre><code class='js'>navigation<c- p>.</c->addEventListener<c- p>(</c-><c- u>&quot;navigate&quot;</c-><c- p>,</c-> e <c- p>=&gt;</c-> <c- p>{</c->
  <c- c1>// Some navigations, e.g. cross-origin navigations, we cannot intercept.</c->
  <c- c1>// Let the browser handle those normally.</c->
  <c- k>if</c-> <c- p>(</c-><c- o>!</c->e<c- p>.</c->canIntercept<c- p>)</c-> <c- p>{</c->
    <c- k>return</c-><c- p>;</c->
  <c- p>}</c->

  <c- c1>// Similarly, don&apos;t intercept fragment navigations or downloads.</c->
  <c- k>if</c-> <c- p>(</c->e<c- p>.</c->hashChange <c- o>||</c-> e<c- p>.</c->downloadRequest <c- o>!==</c-> <c- kc>null</c-><c- p>)</c-> <c- p>{</c->
    <c- k>return</c-><c- p>;</c->
  <c- p>}</c->

  <c- a>const</c-> url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c->event<c- p>.</c->destination<c- p>.</c->url<c- p>);</c->

  <c- k>if</c-> <c- p>(</c->url<c- p>.</c->pathname<c- p>.</c->startsWith<c- p>(</c-><c- u>&quot;/articles/&quot;</c-><c- p>))</c-> <c- p>{</c->
    e<c- p>.</c->intercept<c- p>({</c->
      <c- k>async</c-> handler<c- p>()</c-> <c- p>{</c->
        <c- c1>// The URL has already changed, so show a placeholder while</c->
        <c- c1>// fetching the new content, such as a spinner or loading page.</c->
        renderArticlePagePlaceholder<c- p>();</c->

        <c- c1>// Fetch the new content and display when ready.</c->
        <c- a>const</c-> articleContent <c- o>=</c-> <c- k>await</c-> getArticleContent<c- p>(</c->url<c- p>.</c->pathname<c- p>,</c-> <c- p>{</c-> signal<c- o>:</c-> e<c- p>.</c->signal <c- p>});</c->
        renderArticlePage<c- p>(</c->articleContent<c- p>);</c->
      <c- p>}</c->
    <c- p>});</c->
  <c- p>}</c->
<c- p>});</c-></code></pre>

  <p>Note that the <code id=navigation-api-intro:dom-navigationinterceptoptions-handler><a href=#dom-navigationinterceptoptions-handler>handler</a></code> function can return a promise to represent the asynchronous progress, and success or failure, of the navigation. While the promise is still pending, browser UI can treat the navigation as ongoing (e.g., by presenting a loading spinner). Other parts of the navigation API are also sensitive to these promises, such as the return value of <code id=navigation-api-intro:dom-navigation-navigate><a href=#dom-navigation-navigate>navigation.navigate()</a></code>:

  <pre><code class='js'><c- a>const</c-> <c- p>{</c-> committed<c- p>,</c-> finished <c- p>}</c-> <c- o>=</c-> <c- k>await</c-> navigation<c- p>.</c->navigate<c- p>(</c-><c- u>&quot;/articles/the-navigation-api-is-cool&quot;</c-><c- p>);</c->

<c- c1>// The committed promise will fulfill once the URL has changed, which happens</c->
<c- c1>// immediately (as long as the NavigateEvent wasn&apos;t canceled).</c->
<c- k>await</c-> committed<c- p>;</c->

<c- c1>// The finished promise will fulfill once the Promise returned by handler() has</c->
<c- c1>// fulfilled, which happens once the article is downloaded and rendered. (Or,</c->
<c- c1>// it will reject, if handler() fails along the way).</c->
<c- k>await</c-> finished<c- p>;</c-></code></pre>

  <h5 id=navigation-interface><span class=secno>7.2.6.2</span> The <code id=navigation-interface:navigation><a href=#navigation>Navigation</a></code> interface<a href=#navigation-interface class=self-link></a></h5>

  

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigation' data-dfn-type='interface'><c- g>Navigation</c-></dfn> : <a id='navigation-interface:eventtarget' href='https://dom.spec.whatwg.org/#interface-eventtarget' data-x-internal='eventtarget'><c- n>EventTarget</c-></a> {
  <c- b>sequence</c->&lt;<a href='#navigationhistoryentry' id='navigation-interface:navigationhistoryentry'><c- n>NavigationHistoryEntry</c-></a>&gt; <a href='#dom-navigation-entries' id='navigation-interface:dom-navigation-entries'><c- g>entries</c-></a>();
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationhistoryentry' id='navigation-interface:navigationhistoryentry-2'><c- n>NavigationHistoryEntry</c-></a>? <a href='#dom-navigation-currententry' id='navigation-interface:dom-navigation-currententry'><c- g>currentEntry</c-></a>;
  <c- b>undefined</c-> <a href='#dom-navigation-updatecurrententry' id='navigation-interface:dom-navigation-updatecurrententry'><c- g>updateCurrentEntry</c-></a>(<a href='#navigationupdatecurrententryoptions' id='navigation-interface:navigationupdatecurrententryoptions'><c- n>NavigationUpdateCurrentEntryOptions</c-></a> <c- g>options</c->);
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationtransition' id='navigation-interface:navigationtransition'><c- n>NavigationTransition</c-></a>? <a href='#dom-navigation-transition' id='navigation-interface:dom-navigation-transition'><c- g>transition</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationactivation' id='navigation-interface:navigationactivation'><c- n>NavigationActivation</c-></a>? <a href='#dom-navigation-activation' id='navigation-interface:dom-navigation-activation'><c- g>activation</c-></a>;

  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigation-cangoback' id='navigation-interface:dom-navigation-cangoback'><c- g>canGoBack</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigation-cangoforward' id='navigation-interface:dom-navigation-cangoforward'><c- g>canGoForward</c-></a>;

  <a href='#navigationresult' id='navigation-interface:navigationresult'><c- n>NavigationResult</c-></a> <a href='#dom-navigation-navigate' id='navigation-interface:dom-navigation-navigate'><c- g>navigate</c-></a>(<c- b>USVString</c-> <c- g>url</c->, <c- b>optional</c-> <a href='#navigationnavigateoptions' id='navigation-interface:navigationnavigateoptions'><c- n>NavigationNavigateOptions</c-></a> <c- g>options</c-> = {});
  <a href='#navigationresult' id='navigation-interface:navigationresult-2'><c- n>NavigationResult</c-></a> <a href='#dom-navigation-reload' id='navigation-interface:dom-navigation-reload'><c- g>reload</c-></a>(<c- b>optional</c-> <a href='#navigationreloadoptions' id='navigation-interface:navigationreloadoptions'><c- n>NavigationReloadOptions</c-></a> <c- g>options</c-> = {});

  <a href='#navigationresult' id='navigation-interface:navigationresult-3'><c- n>NavigationResult</c-></a> <a href='#dom-navigation-traverseto' id='navigation-interface:dom-navigation-traverseto'><c- g>traverseTo</c-></a>(<c- b>DOMString</c-> <c- g>key</c->, <c- b>optional</c-> <a href='#navigationoptions' id='navigation-interface:navigationoptions'><c- n>NavigationOptions</c-></a> <c- g>options</c-> = {});
  <a href='#navigationresult' id='navigation-interface:navigationresult-4'><c- n>NavigationResult</c-></a> <a href='#dom-navigation-back' id='navigation-interface:dom-navigation-back'><c- g>back</c-></a>(<c- b>optional</c-> <a href='#navigationoptions' id='navigation-interface:navigationoptions-2'><c- n>NavigationOptions</c-></a> <c- g>options</c-> = {});
  <a href='#navigationresult' id='navigation-interface:navigationresult-5'><c- n>NavigationResult</c-></a> <a href='#dom-navigation-forward' id='navigation-interface:dom-navigation-forward'><c- g>forward</c-></a>(<c- b>optional</c-> <a href='#navigationoptions' id='navigation-interface:navigationoptions-3'><c- n>NavigationOptions</c-></a> <c- g>options</c-> = {});

  <c- b>attribute</c-> <a id='navigation-interface:eventhandler' href='webappapis.html#eventhandler'><c- n>EventHandler</c-></a> <a href='#handler-navigation-onnavigate' id='navigation-interface:handler-navigation-onnavigate'><c- g>onnavigate</c-></a>;
  <c- b>attribute</c-> <a id='navigation-interface:eventhandler-2' href='webappapis.html#eventhandler'><c- n>EventHandler</c-></a> <a href='#handler-navigation-onnavigatesuccess' id='navigation-interface:handler-navigation-onnavigatesuccess'><c- g>onnavigatesuccess</c-></a>;
  <c- b>attribute</c-> <a id='navigation-interface:eventhandler-3' href='webappapis.html#eventhandler'><c- n>EventHandler</c-></a> <a href='#handler-navigation-onnavigateerror' id='navigation-interface:handler-navigation-onnavigateerror'><c- g>onnavigateerror</c-></a>;
  <c- b>attribute</c-> <a id='navigation-interface:eventhandler-4' href='webappapis.html#eventhandler'><c- n>EventHandler</c-></a> <a href='#handler-navigation-oncurrententrychange' id='navigation-interface:handler-navigation-oncurrententrychange'><c- g>oncurrententrychange</c-></a>;
};

<c- b>dictionary</c-> <dfn id='navigationupdatecurrententryoptions' data-dfn-type='dictionary'><c- g>NavigationUpdateCurrentEntryOptions</c-></dfn> {
  <c- b>required</c-> <c- b>any</c-> <dfn data-dfn-for='NavigationUpdateCurrentEntryOptions' id='dom-navigationupdatecurrententryoptions-state' data-dfn-type='dict-member'><c- g>state</c-></dfn>;
};

<c- b>dictionary</c-> <dfn id='navigationoptions' data-dfn-type='dictionary'><c- g>NavigationOptions</c-></dfn> {
  <c- b>any</c-> <dfn data-dfn-for='NavigationOptions' id='dom-navigationoptions-info' data-dfn-type='dict-member'><c- g>info</c-></dfn>;
};

<c- b>dictionary</c-> <dfn id='navigationnavigateoptions' data-dfn-type='dictionary'><c- g>NavigationNavigateOptions</c-></dfn> : <a href='#navigationoptions' id='navigation-interface:navigationoptions-4'><c- n>NavigationOptions</c-></a> {
  <c- b>any</c-> <dfn data-dfn-for='NavigationNavigateOptions' id='dom-navigationnavigateoptions-state' data-dfn-type='dict-member'><c- g>state</c-></dfn>;
  <a href='#navigationhistorybehavior' id='navigation-interface:navigationhistorybehavior'><c- n>NavigationHistoryBehavior</c-></a> <dfn data-dfn-for='NavigationNavigateOptions' id='dom-navigationnavigateoptions-history' data-dfn-type='dict-member'><c- g>history</c-></dfn> = &quot;<a href='browsing-the-web.html#navigationhistorybehavior-auto' id='navigation-interface:navigationhistorybehavior-auto'>auto</a>&quot;;
};

<c- b>dictionary</c-> <dfn id='navigationreloadoptions' data-dfn-type='dictionary'><c- g>NavigationReloadOptions</c-></dfn> : <a href='#navigationoptions' id='navigation-interface:navigationoptions-5'><c- n>NavigationOptions</c-></a> {
  <c- b>any</c-> <dfn data-dfn-for='NavigationNavigateOptions' id='dom-navigationreloadoptions-state' data-dfn-type='dict-member'><c- g>state</c-></dfn>;
};

<c- b>dictionary</c-> <dfn id='navigationresult' data-dfn-type='dictionary'><c- g>NavigationResult</c-></dfn> {
  <a href='https://webidl.spec.whatwg.org/#idl-promise' id='navigation-interface:idl-promise' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<a href='#navigationhistoryentry' id='navigation-interface:navigationhistoryentry-3'><c- n>NavigationHistoryEntry</c-></a>&gt; <dfn data-dfn-for='NavigationResult' id='dom-navigationresult-committed' data-dfn-type='dict-member'><c- g>committed</c-></dfn>;
  <a href='https://webidl.spec.whatwg.org/#idl-promise' id='navigation-interface:idl-promise-2' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<a href='#navigationhistoryentry' id='navigation-interface:navigationhistoryentry-4'><c- n>NavigationHistoryEntry</c-></a>&gt; <dfn data-dfn-for='NavigationResult' id='dom-navigationresult-finished' data-dfn-type='dict-member'><c- g>finished</c-></dfn>;
};

<c- b>enum</c-> <dfn id='navigationhistorybehavior' data-dfn-type='enum'><c- g>NavigationHistoryBehavior</c-></dfn> {
  <c- s>&quot;</c-><a href='browsing-the-web.html#navigationhistorybehavior-auto' id='navigation-interface:navigationhistorybehavior-auto-2'><c- s>auto</c-></a><c- s>&quot;</c->,
  <c- s>&quot;</c-><a href='browsing-the-web.html#navigationhistorybehavior-push' id='navigation-interface:navigationhistorybehavior-push'><c- s>push</c-></a><c- s>&quot;</c->,
  <c- s>&quot;</c-><a href='browsing-the-web.html#navigationhistorybehavior-replace' id='navigation-interface:navigationhistorybehavior-replace'><c- s>replace</c-></a><c- s>&quot;</c->
};</code></pre>

  <p>Each <code id=navigation-interface:window><a href=#window>Window</a></code> has an associated <dfn id=window-navigation-api>navigation
  API</dfn>, which is a <code id=navigation-interface:navigation-2><a href=#navigation>Navigation</a></code> object. Upon creation of the <code id=navigation-interface:window-2><a href=#window>Window</a></code>
  object, its <a href=#window-navigation-api id=navigation-interface:window-navigation-api>navigation API</a> must be set to a
  <a id=navigation-interface:new href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigation-interface:navigation-3><a href=#navigation>Navigation</a></code> object created in the <code id=navigation-interface:window-3><a href=#window>Window</a></code> object's <a href=webappapis.html#concept-relevant-realm id=navigation-interface:concept-relevant-realm>relevant realm</a>.</p>

  <p>The <dfn data-dfn-for=Window id=dom-navigation data-dfn-type=attribute><code>navigation</code></dfn> getter
  steps are to return <a id=navigation-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#window-navigation-api id=navigation-interface:window-navigation-api-2>navigation
  API</a>.</p>

  

  <p>The following are the <a id=navigation-interface:event-handlers href=webappapis.html#event-handlers>event handlers</a> (and their corresponding <a href=webappapis.html#event-handler-event-type id=navigation-interface:event-handler-event-type>event handler event types</a>) that must be supported,
  as <a id=navigation-interface:event-handler-idl-attributes href=webappapis.html#event-handler-idl-attributes>event handler IDL attributes</a>, by all objects implementing the
  <code id=navigation-interface:navigation-4><a href=#navigation>Navigation</a></code> interface:</p>

  <table><thead><tr><th><a href=webappapis.html#event-handlers id=navigation-interface:event-handlers-2>Event handler</a>
     <th><a id=navigation-interface:event-handler-event-type-2 href=webappapis.html#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn data-dfn-for=Navigation id=handler-navigation-onnavigate data-dfn-type=attribute><code>onnavigate</code></dfn>
     <td><code id=navigation-interface:event-navigate><a href=indices.html#event-navigate>navigate</a></code>
    <tr><td><dfn data-dfn-for=Navigation id=handler-navigation-onnavigatesuccess data-dfn-type=attribute><code>onnavigatesuccess</code></dfn>
     <td><code id=navigation-interface:event-navigatesuccess><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code>
    <tr><td><dfn data-dfn-for=Navigation id=handler-navigation-onnavigateerror data-dfn-type=attribute><code>onnavigateerror</code></dfn>
     <td><code id=navigation-interface:event-navigateerror><a href=indices.html#event-navigateerror>navigateerror</a></code>
    <tr><td><dfn data-dfn-for=Navigation id=handler-navigation-oncurrententrychange data-dfn-type=attribute><code>oncurrententrychange</code></dfn>
     <td><code id=navigation-interface:event-currententrychange><a href=indices.html#event-currententrychange>currententrychange</a></code>
  </table>

  <h5 id=navigation-api-core><span class=secno>7.2.6.3</span> Core infrastructure<a href=#navigation-api-core class=self-link></a></h5>

  

  <p>Each <code id=navigation-api-core:navigation><a href=#navigation>Navigation</a></code> has an associated <dfn id=navigation-entry-list>entry
  list</dfn>, a <a id=navigation-api-core:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <code id=navigation-api-core:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> objects, initially
  empty.</p>

  <p>Each <code id=navigation-api-core:navigation-2><a href=#navigation>Navigation</a></code> has an associated <dfn id=navigation-current-entry-index>current entry index</dfn>, an integer, initially
  −1.</p>

  <p>The <dfn id=navigation-current-entry>current entry</dfn> of a <code id=navigation-api-core:navigation-3><a href=#navigation>Navigation</a></code>
  <var>navigation</var> is the result of running the following steps:</p>

  <ol><li><p>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=navigation-api-core:has-entries-and-events-disabled>has entries and events disabled</a>, then return
   null.<li><p><a id=navigation-api-core:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-core:navigation-current-entry-index>current entry index</a> is not −1.<li><p>Return <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-core:navigation-entry-list>entry
   list</a>[<var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-core:navigation-current-entry-index-2>current entry
   index</a>].</ol>

  <p>A <code id=navigation-api-core:navigation-4><a href=#navigation>Navigation</a></code> <var>navigation</var> <dfn id=has-entries-and-events-disabled>has entries and events disabled</dfn> if
  the following steps return true:</p>

  <ol><li><p>Let <var>document</var> be <var>navigation</var>'s <a id=navigation-api-core:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#concept-document-window id=navigation-api-core:concept-document-window>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=navigation-api-core:fully-active href=document-sequences.html#fully-active>fully active</a>, then return true.<li><p>If <var>document</var>'s <a id=navigation-api-core:is-initial-about:blank href=dom.html#is-initial-about:blank>is initial <code>about:blank</code></a> is true, then
   return true.<li><p>If <var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=navigation-api-core:concept-document-origin data-x-internal=concept-document-origin>origin</a> is <a href=browsers.html#concept-origin-opaque id=navigation-api-core:concept-origin-opaque>opaque</a>, then return true.<li><p>Return false.</ol>

  <p>To <dfn id=getting-the-navigation-api-entry-index>get the navigation API entry
  index</dfn> of a <a id=navigation-api-core:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a> <var>she</var> within a
  <code id=navigation-api-core:navigation-5><a href=#navigation>Navigation</a></code> <var>navigation</var>:</p>

  <ol><li><p>Let <var>index</var> be 0.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigation-api-core:list-iterate data-x-internal=list-iterate>For each</a> <var>nhe</var> of <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-core:navigation-entry-list-2>entry list</a>:</p>

    <ol><li><p>If <var>nhe</var>'s <a href=#nhe-she id=navigation-api-core:nhe-she>session history entry</a> is equal to
     <var>she</var>, then return <var>index</var>.<li><p>Increment <var>index</var> by 1.</ol>
   <li><p>Return −1.</ol>

  <hr>

  

  <p>A key type used throughout the navigation API is the <code id=navigation-api-core:navigationtype><a href=#navigationtype>NavigationType</a></code>
  enumeration:</p>

  <pre><code class='idl'><c- b>enum</c-> <dfn id='navigationtype' data-dfn-type='enum'><c- g>NavigationType</c-></dfn> {
 <c- s>&quot;</c-><a href='#dom-navigationtype-push' id='navigation-api-core:dom-navigationtype-push'><c- s>push</c-></a><c- s>&quot;</c->,
 <c- s>&quot;</c-><a href='#dom-navigationtype-replace' id='navigation-api-core:dom-navigationtype-replace'><c- s>replace</c-></a><c- s>&quot;</c->,
 <c- s>&quot;</c-><a href='#dom-navigationtype-reload' id='navigation-api-core:dom-navigationtype-reload'><c- s>reload</c-></a><c- s>&quot;</c->,
 <c- s>&quot;</c-><a href='#dom-navigationtype-traverse' id='navigation-api-core:dom-navigationtype-traverse'><c- s>traverse</c-></a><c- s>&quot;</c->
};</code></pre>

  <p>This captures the main web developer-visible types of "navigations", which (as <a href=browsing-the-web.html#note-meaning-of-navigate>noted elsewhere</a>) do not exactly correspond to this standard's
  singular <a id=navigation-api-core:navigate href=browsing-the-web.html#navigate>navigate</a> algorithm. The meaning of each value is the following:</p>

  <dl><dt>"<dfn data-dfn-for=NavigationType id=dom-navigationtype-push data-dfn-type=enum-value><code>push</code></dfn>"<dd>Corresponds to calls to <a id=navigation-api-core:navigate-2 href=browsing-the-web.html#navigate>navigate</a> where the <a id=navigation-api-core:history-handling-behavior href=browsing-the-web.html#history-handling-behavior>history handling
   behavior</a> ends up as "<code id=navigation-api-core:navigationhistorybehavior-push><a href=browsing-the-web.html#navigationhistorybehavior-push>push</a></code>", or to
   <code id=navigation-api-core:dom-history-pushstate><a href=#dom-history-pushstate>history.pushState()</a></code>.<dt>"<dfn data-dfn-for=NavigationType id=dom-navigationtype-replace data-dfn-type=enum-value><code>replace</code></dfn>"<dd>Corresponds to calls to <a id=navigation-api-core:navigate-3 href=browsing-the-web.html#navigate>navigate</a> where the <a id=navigation-api-core:history-handling-behavior-2 href=browsing-the-web.html#history-handling-behavior>history handling
   behavior</a> ends up as "<code id=navigation-api-core:navigationhistorybehavior-replace><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>", or
   to <code id=navigation-api-core:dom-history-pushstate-2><a href=#dom-history-pushstate>history.replaceState()</a></code>.<dt>"<dfn data-dfn-for=NavigationType id=dom-navigationtype-reload data-dfn-type=enum-value><code>reload</code></dfn>"<dd>Corresponds to calls to <a id=navigation-api-core:reload href=browsing-the-web.html#reload>reload</a>.<dt>"<dfn data-dfn-for=NavigationType id=dom-navigationtype-traverse data-dfn-type=enum-value><code>traverse</code></dfn>"<dd>Corresponds to calls to <a id=navigation-api-core:traverse-the-history-by-a-delta href=browsing-the-web.html#traverse-the-history-by-a-delta>traverse the history by a delta</a>.</dl>

  

  <p class=note>The value space of the <code id=navigation-api-core:navigationtype-2><a href=#navigationtype>NavigationType</a></code> enumeration is a superset of
  the value space of the specification-internal <a id=navigation-api-core:history-handling-behavior-3 href=browsing-the-web.html#history-handling-behavior>history handling behavior</a> type. Several
  parts of this standard make use of this overlap, by passing in a <a id=navigation-api-core:history-handling-behavior-4 href=browsing-the-web.html#history-handling-behavior>history handling
  behavior</a> to an algorithm that expects a <code id=navigation-api-core:navigationtype-3><a href=#navigationtype>NavigationType</a></code>.</p>


  <h5 id=navigation-api-entry-updates><span class=secno>7.2.6.4</span> Initializing and updating the entry list<a href=#navigation-api-entry-updates class=self-link></a></h5>

  <p>To <dfn id=initialize-the-navigation-api-entries-for-a-new-document>initialize the navigation API entries for a new document</dfn> given a
  <code id=navigation-api-entry-updates:navigation><a href=#navigation>Navigation</a></code> <var>navigation</var>, a <a id=navigation-api-entry-updates:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <a href=browsing-the-web.html#session-history-entry id=navigation-api-entry-updates:session-history-entry>session history entries</a> <var>newSHEs</var>, and a <a id=navigation-api-entry-updates:session-history-entry-2 href=browsing-the-web.html#session-history-entry>session history
  entry</a> <var>initialSHE</var>:</p>

  <ol><li><p><a id=navigation-api-entry-updates:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list>entry
   list</a> <a href=https://infra.spec.whatwg.org/#list-is-empty id=navigation-api-entry-updates:list-is-empty data-x-internal=list-is-empty>is empty</a>.<li><p><a id=navigation-api-entry-updates:assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index>current entry index</a> is −1.<li><p>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=navigation-api-entry-updates:has-entries-and-events-disabled>has entries and events disabled</a>, then
   return.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigation-api-entry-updates:list-iterate data-x-internal=list-iterate>For each</a> <var>newSHE</var> of <var>newSHEs</var>:</p>

    <ol><li><p>Let <var>newNHE</var> be a <a id=navigation-api-entry-updates:new href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigation-api-entry-updates:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> created
     in the <a href=webappapis.html#concept-relevant-realm id=navigation-api-entry-updates:concept-relevant-realm>relevant realm</a> of
     <var>navigation</var>.<li><p>Set <var>newNHE</var>'s <a href=#nhe-she id=navigation-api-entry-updates:nhe-she>session history entry</a> to
     <var>newSHE</var>.<li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigation-api-entry-updates:list-append data-x-internal=list-append>Append</a> <var>newNHE</var> to <var>navigation</var>'s
     <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-2>entry list</a>.</ol>

    <p class=note><var>newSHEs</var> will have originally come from <a id=navigation-api-entry-updates:getting-session-history-entries-for-the-navigation-api href=browsing-the-web.html#getting-session-history-entries-for-the-navigation-api>getting session history
    entries for the navigation API</a>, and thus each <var>newSHE</var> will be contiguous <a href=browsers.html#same-origin id=navigation-api-entry-updates:same-origin>same</a> <a href=browsing-the-web.html#document-state-origin id=navigation-api-entry-updates:document-state-origin>origin</a> with
    <var>initialSHE</var>.</p>
   <li><p>Set <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-2>current entry
   index</a> to the result of <a href=#getting-the-navigation-api-entry-index id=navigation-api-entry-updates:getting-the-navigation-api-entry-index>getting the navigation API entry index</a> of
   <var>initialSHE</var> within <var>navigation</var>.</ol>

  <p>To <dfn id=update-the-navigation-api-entries-for-reactivation>update the navigation API entries for reactivation</dfn> given a
  <code id=navigation-api-entry-updates:navigation-2><a href=#navigation>Navigation</a></code> <var>navigation</var>, a <a id=navigation-api-entry-updates:list-2 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <a href=browsing-the-web.html#session-history-entry id=navigation-api-entry-updates:session-history-entry-3>session history entries</a> <var>newSHEs</var>, and a <a id=navigation-api-entry-updates:session-history-entry-4 href=browsing-the-web.html#session-history-entry>session history
  entry</a> <var>reactivatedSHE</var>:</p>

  <ol><li><p>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=navigation-api-entry-updates:has-entries-and-events-disabled-2>has entries and events disabled</a>, then
   return.<li><p>Let <var>newNHEs</var> be a new empty <a id=navigation-api-entry-updates:list-3 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li><p>Let <var>oldNHEs</var> be a <a href=https://infra.spec.whatwg.org/#list-clone id=navigation-api-entry-updates:list-clone data-x-internal=list-clone>clone</a> of
   <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-3>entry list</a>.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigation-api-entry-updates:list-iterate-2 data-x-internal=list-iterate>For each</a> <var>newSHE</var> of <var>newSHEs</var>:</p>

    <ol><li><p>Let <var>newNHE</var> be null.<li>
      <p>If <var>oldNHEs</var> <a href=https://infra.spec.whatwg.org/#list-contain id=navigation-api-entry-updates:list-contains data-x-internal=list-contains>contains</a> a
      <code id=navigation-api-entry-updates:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> <var>matchingOldNHE</var> whose <a href=#nhe-she id=navigation-api-entry-updates:nhe-she-2>session history entry</a> is <var>newSHE</var>, then:</p>

      <ol><li><p>Set <var>newNHE</var> to <var>matchingOldNHE</var>.<li><p><a href=https://infra.spec.whatwg.org/#list-remove id=navigation-api-entry-updates:list-remove data-x-internal=list-remove>Remove</a> <var>matchingOldNHE</var> from
       <var>oldNHEs</var>.</ol>
     <li>
      <p>Otherwise:</p>

      <ol><li><p>Set <var>newNHE</var> to a <a id=navigation-api-entry-updates:new-2 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigation-api-entry-updates:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>
       created in the <a href=webappapis.html#concept-relevant-realm id=navigation-api-entry-updates:concept-relevant-realm-2>relevant realm</a> of
       <var>navigation</var>.<li><p>Set <var>newNHE</var>'s <a href=#nhe-she id=navigation-api-entry-updates:nhe-she-3>session history entry</a> to
       <var>newSHE</var>.</ol>
     <li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigation-api-entry-updates:list-append-2 data-x-internal=list-append>Append</a> <var>newNHE</var> to
     <var>newNHEs</var>.</ol>

    <p class=note><var>newSHEs</var> will have originally come from <a id=navigation-api-entry-updates:getting-session-history-entries-for-the-navigation-api-2 href=browsing-the-web.html#getting-session-history-entries-for-the-navigation-api>getting session history
    entries for the navigation API</a>, and thus each <var>newSHE</var> will be contiguous <a href=browsers.html#same-origin id=navigation-api-entry-updates:same-origin-2>same</a> <a href=browsing-the-web.html#document-state-origin id=navigation-api-entry-updates:document-state-origin-2>origin</a> with
    <var>reactivatedSHE</var>.</p>

    <p class=note>By the end of this loop, all <code id=navigation-api-entry-updates:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>s that remain in
    <var>oldNHEs</var> represent <a href=browsing-the-web.html#session-history-entry id=navigation-api-entry-updates:session-history-entry-5>session history entries</a>
    which have been disposed while the <code id=navigation-api-entry-updates:document><a href=dom.html#document>Document</a></code> was in <a href=browsing-the-web.html#note-bfcache>bfcache</a>.</p>
   <li><p>Set <var>navigation</var>'s <a id=navigation-api-entry-updates:entry-list href=form-control-infrastructure.html#entry-list>entry list</a> to <var>newNHEs</var>.<li><p>Set <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-3>current entry
   index</a> to the result of <a href=#getting-the-navigation-api-entry-index id=navigation-api-entry-updates:getting-the-navigation-api-entry-index-2>getting the navigation API entry index</a> of
   <var>reactivatedSHE</var> within <var>navigation</var>.<li>
    <p><a id=navigation-api-entry-updates:queue-a-global-task href=webappapis.html#queue-a-global-task>Queue a global task</a> on the <a id=navigation-api-entry-updates:navigation-and-traversal-task-source href=webappapis.html#navigation-and-traversal-task-source>navigation and traversal task source</a>
    given <var>navigation</var>'s <a id=navigation-api-entry-updates:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a> to run the following
    steps:</p>

    <ol><li>
      <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigation-api-entry-updates:list-iterate-3 data-x-internal=list-iterate>For each</a> <var>disposedNHE</var> of
      <var>oldNHEs</var>:</p>

      <ol><li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=navigation-api-entry-updates:concept-event-fire data-x-internal=concept-event-fire>Fire an event</a> named <code id=navigation-api-entry-updates:event-dispose><a href=indices.html#event-dispose>dispose</a></code> at <var>disposedNHE</var>.</ol>
     </ol>

    <div class=note>
     <p>We delay these steps by a task to ensure that <code id=navigation-api-entry-updates:event-dispose-2><a href=indices.html#event-dispose>dispose</a></code>
     events will fire after the <code id=navigation-api-entry-updates:event-pageshow><a href=indices.html#event-pageshow>pageshow</a></code> event. This ensures
     that <code id=navigation-api-entry-updates:event-pageshow-2><a href=indices.html#event-pageshow>pageshow</a></code> is the first event a page receives upon
     <a href=browsing-the-web.html#reactivate-a-document id=navigation-api-entry-updates:reactivate-a-document>reactivation</a>.</p>

     <p>(However, the rest of this algorithm runs before the <code id=navigation-api-entry-updates:event-pageshow-3><a href=indices.html#event-pageshow>pageshow</a></code> event fires. This ensures that <code id=navigation-api-entry-updates:dom-navigation-entries><a href=#dom-navigation-entries>navigation.entries()</a></code> and <code id=navigation-api-entry-updates:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> will have correctly-updated
     values during any <code id=navigation-api-entry-updates:event-pageshow-4><a href=indices.html#event-pageshow>pageshow</a></code> event handlers.)</p>
    </div>
   </ol>

  <p>To <dfn id=update-the-navigation-api-entries-for-a-same-document-navigation>update the navigation API entries for a same-document navigation</dfn> given a
  <code id=navigation-api-entry-updates:navigation-3><a href=#navigation>Navigation</a></code> <var>navigation</var>, a <a id=navigation-api-entry-updates:session-history-entry-6 href=browsing-the-web.html#session-history-entry>session history entry</a>
  <var>destinationSHE</var>, and a <code id=navigation-api-entry-updates:navigationtype><a href=#navigationtype>NavigationType</a></code> <var>navigationType</var>:</p>

  <ol><li><p>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=navigation-api-entry-updates:has-entries-and-events-disabled-3>has entries and events disabled</a>, then
   return.<li><p>Let <var>oldCurrentNHE</var> be the <a href=#navigation-current-entry id=navigation-api-entry-updates:navigation-current-entry>current
   entry</a> of <var>navigation</var>.<li><p>Let <var>disposedNHEs</var> be a new empty <a id=navigation-api-entry-updates:list-4 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li>
    <p>If <var>navigationType</var> is "<code id=navigation-api-entry-updates:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>",
    then:</p>

    <ol><li><p>Set <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-4>current entry
     index</a> to the result of <a href=#getting-the-navigation-api-entry-index id=navigation-api-entry-updates:getting-the-navigation-api-entry-index-3>getting the navigation API entry index</a> of
     <var>destinationSHE</var> within <var>navigation</var>.<li><p><a id=navigation-api-entry-updates:assert-3 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-5>current entry index</a> is not −1.</ol>

    <p class=note>This algorithm is only called for same-document traversals. Cross-document
    traversals will instead call either <a href=#initialize-the-navigation-api-entries-for-a-new-document id=navigation-api-entry-updates:initialize-the-navigation-api-entries-for-a-new-document>initialize the navigation API entries for a new
    document</a> or <a href=#update-the-navigation-api-entries-for-reactivation id=navigation-api-entry-updates:update-the-navigation-api-entries-for-reactivation>update the navigation API entries for reactivation</a>.</p>
   <li>
    <p>Otherwise, if <var>navigationType</var> is "<code id=navigation-api-entry-updates:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>", then:</p>

    <ol><li><p>Set <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-6>current entry
     index</a> to <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-7>current
     entry index</a> + 1.<li><p>Let <var>i</var> be <var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-8>current entry index</a>.<li>
      <p><a id=navigation-api-entry-updates:while href=https://infra.spec.whatwg.org/#iteration-while data-x-internal=while>While</a> <var>i</var> &lt; <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-4>entry list</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=navigation-api-entry-updates:list-size data-x-internal=list-size>size</a>:</p>

      <ol><li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigation-api-entry-updates:list-append-3 data-x-internal=list-append>Append</a> <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-5>entry list</a>[<var>i</var>] to
       <var>disposedNHEs</var>.<li><p>Set <var>i</var> to <var>i</var> + 1.</ol>
     <li><p><a href=https://infra.spec.whatwg.org/#list-remove id=navigation-api-entry-updates:list-remove-2 data-x-internal=list-remove>Remove</a> all items in <var>disposedNHEs</var> from
     <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-6>entry list</a>.</ol>
   <li>
    <p>Otherwise, if <var>navigationType</var> is "<code id=navigation-api-entry-updates:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>", then:</p>

    <ol><li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigation-api-entry-updates:list-append-4 data-x-internal=list-append>Append</a> <var>oldCurrentNHE</var> to
     <var>disposedNHEs</var>.</ol>
   <li>
    <p>If <var>navigationType</var> is "<code id=navigation-api-entry-updates:dom-navigationtype-push-2><a href=#dom-navigationtype-push>push</a></code>" or
    "<code id=navigation-api-entry-updates:dom-navigationtype-replace-2><a href=#dom-navigationtype-replace>replace</a></code>", then:</p>

    <ol><li><p>Let <var>newNHE</var> be a <a id=navigation-api-entry-updates:new-3 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigation-api-entry-updates:navigationhistoryentry-5><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> created
     in the <a href=webappapis.html#concept-relevant-realm id=navigation-api-entry-updates:concept-relevant-realm-3>relevant realm</a> of
     <var>navigation</var>.<li><p>Set <var>newNHE</var>'s <a href=#nhe-she id=navigation-api-entry-updates:nhe-she-4>session history entry</a> to
     <var>destinationSHE</var>.<li><p>Set <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-entry-updates:navigation-entry-list-7>entry
     list</a>[<var>navigation</var>'s <a href=#navigation-current-entry-index id=navigation-api-entry-updates:navigation-current-entry-index-9>current entry
     index</a>] to <var>newNHE</var>.</ol>
   <li>
    <p>If <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=navigation-api-entry-updates:ongoing-api-method-tracker>ongoing API method tracker</a> is non-null, then
    <a href=#notify-about-the-committed-to-entry id=navigation-api-entry-updates:notify-about-the-committed-to-entry>notify about the committed-to entry</a> given <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=navigation-api-entry-updates:ongoing-api-method-tracker-2>ongoing API
    method tracker</a> and the <a href=#navigation-current-entry id=navigation-api-entry-updates:navigation-current-entry-2>current entry</a> of
    <var>navigation</var>.</p>

    <p class=note>It is important to do this before firing the <code id=navigation-api-entry-updates:event-dispose-3><a href=indices.html#event-dispose>dispose</a></code> or <code id=navigation-api-entry-updates:event-currententrychange><a href=indices.html#event-currententrychange>currententrychange</a></code> events, since event handlers could
    start another navigation, or otherwise change the value of <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=navigation-api-entry-updates:ongoing-api-method-tracker-3>ongoing
    API method tracker</a>.</p>
   <li>
    <p><a id=navigation-api-entry-updates:prepare-to-run-script href=webappapis.html#prepare-to-run-script>Prepare to run script</a> given <var>navigation</var>'s <a id=navigation-api-entry-updates:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings
    object</a>.</p>

    <p class=note>See <a href=#note-suppress-microtasks-during-navigation-events>the discussion
    for other navigation API events</a> to understand why we do this.</p>
   <li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=navigation-api-entry-updates:concept-event-fire-2 data-x-internal=concept-event-fire>Fire an event</a> named <code id=navigation-api-entry-updates:event-currententrychange-2><a href=indices.html#event-currententrychange>currententrychange</a></code> at <var>navigation</var> using
   <code id=navigation-api-entry-updates:navigationcurrententrychangeevent><a href=#navigationcurrententrychangeevent>NavigationCurrentEntryChangeEvent</a></code>, with its <code id=navigation-api-entry-updates:dom-navigationcurrententrychangeevent-navigationtype><a href=#dom-navigationcurrententrychangeevent-navigationtype>navigationType</a></code> attribute
   initialized to <var>navigationType</var> and its <code id=navigation-api-entry-updates:dom-navigationcurrententrychangeevent-from><a href=#dom-navigationcurrententrychangeevent-from>from</a></code> initialized to
   <var>oldCurrentNHE</var>.<li>
    <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigation-api-entry-updates:list-iterate-4 data-x-internal=list-iterate>For each</a> <var>disposedNHE</var> of
    <var>disposedNHEs</var>:</p>

    <ol><li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=navigation-api-entry-updates:concept-event-fire-3 data-x-internal=concept-event-fire>Fire an event</a> named <code id=navigation-api-entry-updates:event-dispose-4><a href=indices.html#event-dispose>dispose</a></code> at <var>disposedNHE</var>.</ol>
   <li><p><a id=navigation-api-entry-updates:clean-up-after-running-script href=webappapis.html#clean-up-after-running-script>Clean up after running script</a> given <var>navigation</var>'s <a id=navigation-api-entry-updates:relevant-settings-object-2 href=webappapis.html#relevant-settings-object>relevant
   settings object</a>.</ol>

  <p class=XXX>In implementations, same-document navigations can cause <a href=browsing-the-web.html#session-history-entry id=navigation-api-entry-updates:session-history-entry-7>session history entries</a> to be disposed by falling off the back of the
  session history entry list. This is not yet handled by the above algorithm (or by any other part
  of this standard). See <a href=https://github.com/whatwg/html/issues/8620>issue #8620</a> to
  track progress on defining the correct behavior in such cases.</p>

  


  <h5 id=the-navigationhistoryentry-interface><span class=secno>7.2.6.5</span> The <code id=the-navigationhistoryentry-interface:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> interface<a href=#the-navigationhistoryentry-interface class=self-link></a></h5>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigationhistoryentry' data-dfn-type='interface'><c- g>NavigationHistoryEntry</c-></dfn> : <a id='the-navigationhistoryentry-interface:eventtarget' href='https://dom.spec.whatwg.org/#interface-eventtarget' data-x-internal='eventtarget'><c- n>EventTarget</c-></a> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c->? <a href='#dom-navigationhistoryentry-url' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-url'><c- g>url</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-navigationhistoryentry-key' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-key'><c- g>key</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-navigationhistoryentry-id' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-id'><c- g>id</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>long</c-> <c- b>long</c-> <a href='#dom-navigationhistoryentry-index' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-index'><c- g>index</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigationhistoryentry-samedocument' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-samedocument'><c- g>sameDocument</c-></a>;

  <c- b>any</c-> <a href='#dom-navigationhistoryentry-getstate' id='the-navigationhistoryentry-interface:dom-navigationhistoryentry-getstate'><c- g>getState</c-></a>();

  <c- b>attribute</c-> <a id='the-navigationhistoryentry-interface:eventhandler' href='webappapis.html#eventhandler'><c- n>EventHandler</c-></a> <a href='#handler-navigationhistoryentry-ondispose' id='the-navigationhistoryentry-interface:handler-navigationhistoryentry-ondispose'><c- g>ondispose</c-></a>;
};</code></pre>

  <dl class=domintro><dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-url id=dom-navigationhistoryentry-url-dev>url</a></code><dd>
    <p>The URL of this navigation history entry.</p>

    <p>This can return null if the entry corresponds to a different <code id=the-navigationhistoryentry-interface:document><a href=dom.html#document>Document</a></code> than the
    current one (i.e., if <code id=the-navigationhistoryentry-interface:dom-navigationhistoryentry-samedocument-2><a href=#dom-navigationhistoryentry-samedocument>sameDocument</a></code>
    is false), and that <code id=the-navigationhistoryentry-interface:document-2><a href=dom.html#document>Document</a></code> was fetched with a <a id=the-navigationhistoryentry-interface:referrer-policy href=https://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internal=referrer-policy>referrer policy</a> of
    "<code>no-referrer</code>" or "<code>origin</code>", since that indicates
    the <code id=the-navigationhistoryentry-interface:document-3><a href=dom.html#document>Document</a></code> in question is hiding its URL even from other same-origin pages.</p>
   <dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-key id=dom-navigationhistoryentry-key-dev>key</a></code><dd>
    <p>A user agent-generated random UUID string representing this navigation history entry's place
    in the navigation history list. This value will be reused by other
    <code id=the-navigationhistoryentry-interface:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> instances that replace this one due to "<code id=the-navigationhistoryentry-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>" navigations, and will survive reloads and
    session restores.</p>

    <p>This is useful for navigating back to this entry in the navigation history list, using <code id=the-navigationhistoryentry-interface:dom-navigation-traverseto><a href=#dom-navigation-traverseto>navigation.traverseTo(key)</a></code>.</p>
   <dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-id id=dom-navigationhistoryentry-id-dev>id</a></code><dd>
    <p>A user agent-generated random UUID string representing this specific navigation history
    entry. This value will <em>not</em> be reused by other <code id=the-navigationhistoryentry-interface:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>
    instances. This value will survive reloads and session restores.</p>

    <p>This is useful for associating data with this navigation history entry using other storage
    APIs.</p>
   <dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-index id=dom-navigationhistoryentry-index-dev>index</a></code><dd><p>The index of this <code id=the-navigationhistoryentry-interface:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> within <code id=the-navigationhistoryentry-interface:dom-navigation-entries><a href=#dom-navigation-entries>navigation.entries()</a></code>, or −1 if the entry is not in
   the navigation history entry list.<dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-samedocument id=dom-navigationhistoryentry-samedocument-dev>sameDocument</a></code><dd><p>Indicates whether or not this navigation history entry is for the same
   <code id=the-navigationhistoryentry-interface:document-4><a href=dom.html#document>Document</a></code> as the current one, or not. This will be true, for example, when the entry
   represents a fragment navigation or single-page app navigation.<dt><code><var>entry</var>.<a href=#dom-navigationhistoryentry-getstate id=dom-navigationhistoryentry-getstate-dev>getState</a>()</code><dd>
    <p>Returns the <a href=structured-data.html#structureddeserialize id=the-navigationhistoryentry-interface:structureddeserialize>deserialization</a> of the state stored
    in this entry, which was added to the entry using <code id=the-navigationhistoryentry-interface:dom-navigation-navigate><a href=#dom-navigation-navigate>navigation.navigate()</a></code> or <code id=the-navigationhistoryentry-interface:dom-navigation-updatecurrententry><a href=#dom-navigation-updatecurrententry>navigation.updateCurrentEntry()</a></code>. This state
    survives reloads and session restores.</p>

    <p>Note that in general, unless the state value is a primitive, <code class=js>entry.getState() !== entry.getState()</code>, since a fresh deserialization is
    returned each time.</p>

    <p>This state is unrelated to the classic history API's <code id=the-navigationhistoryentry-interface:dom-history-state><a href=#dom-history-state>history.state</a></code>.</p>
   </dl>

  

  <p>Each <code id=the-navigationhistoryentry-interface:navigationhistoryentry-5><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> has an associated <dfn id=nhe-she>session
  history entry</dfn>, which is a <a id=the-navigationhistoryentry-interface:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a>.</p>

  <p>The <dfn id=concept-navigationhistoryentry-key>key</dfn> of a
  <code id=the-navigationhistoryentry-interface:navigationhistoryentry-6><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> <var>nhe</var> is given by the return value of the following
  algorithm:</p>

  <ol><li><p>If <var>nhe</var>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window>associated <code>Document</code></a> is not <a id=the-navigationhistoryentry-interface:fully-active href=document-sequences.html#fully-active>fully
   active</a>, then return the empty string.<li><p>Return <var>nhe</var>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-key id=the-navigationhistoryentry-interface:she-navigation-api-key>navigation API key</a>.</ol>

  <p>The <dfn id=concept-navigationhistoryentry-id>ID</dfn> of a
  <code id=the-navigationhistoryentry-interface:navigationhistoryentry-7><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> <var>nhe</var> is given by the return value of the following
  algorithm:</p>

  <ol><li><p>If <var>nhe</var>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window-2>associated <code>Document</code></a> is not <a id=the-navigationhistoryentry-interface:fully-active-2 href=document-sequences.html#fully-active>fully
   active</a>, then return the empty string.<li><p>Return <var>nhe</var>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she-2>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-id id=the-navigationhistoryentry-interface:she-navigation-api-id>navigation API ID</a>.</ol>

  <p>The <dfn id=concept-navigationhistoryentry-index>index</dfn> of a
  <code id=the-navigationhistoryentry-interface:navigationhistoryentry-8><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> <var>nhe</var> is given by the return value of the following
  algorithm:</p>

  <ol><li><p>If <var>nhe</var>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window-3>associated <code>Document</code></a> is not <a id=the-navigationhistoryentry-interface:fully-active-3 href=document-sequences.html#fully-active>fully
   active</a>, then return −1.<li><p>Return the result of <a href=#getting-the-navigation-api-entry-index id=the-navigationhistoryentry-interface:getting-the-navigation-api-entry-index>getting the navigation API entry index</a> of
   <a id=the-navigationhistoryentry-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she-3>session history entry</a> within
   <a id=the-navigationhistoryentry-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-navigation-api id=the-navigationhistoryentry-interface:window-navigation-api>navigation API</a>.</ol>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-url data-dfn-type=attribute><code>url</code></dfn> getter steps are:</p>

  <ol><li><p>Let <var>document</var> be <a id=the-navigationhistoryentry-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-5 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window-4>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=the-navigationhistoryentry-interface:fully-active-4 href=document-sequences.html#fully-active>fully active</a>, then return the empty
   string.<li><p>Let <var>she</var> be <a id=the-navigationhistoryentry-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she-4>session history
   entry</a>.<li><p>If <var>she</var>'s <a href=browsing-the-web.html#she-document id=the-navigationhistoryentry-interface:she-document>document</a> does not equal
   <var>document</var>, and <var>she</var>'s <a href=browsing-the-web.html#she-document-state id=the-navigationhistoryentry-interface:she-document-state>document
   state</a>'s <a href=browsing-the-web.html#document-state-request-referrer-policy id=the-navigationhistoryentry-interface:document-state-request-referrer-policy>request referrer
   policy</a> is "<code>no-referrer</code>" or "<code>origin</code>", then
   return null.<li><p>Return <var>she</var>'s <a href=browsing-the-web.html#she-url id=the-navigationhistoryentry-interface:she-url>URL</a>, <a href=https://url.spec.whatwg.org/#concept-url-serializer id=the-navigationhistoryentry-interface:concept-url-serializer data-x-internal=concept-url-serializer>serialized</a>.</ol>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-key data-dfn-type=attribute><code>key</code></dfn> getter steps are to return
  <a id=the-navigationhistoryentry-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationhistoryentry-key id=the-navigationhistoryentry-interface:concept-navigationhistoryentry-key>key</a>.</p>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-id data-dfn-type=attribute><code>id</code></dfn> getter steps are to return
  <a id=the-navigationhistoryentry-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationhistoryentry-id id=the-navigationhistoryentry-interface:concept-navigationhistoryentry-id>ID</a>.</p>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-index data-dfn-type=attribute><code>index</code></dfn> getter steps are to return
  <a id=the-navigationhistoryentry-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationhistoryentry-index id=the-navigationhistoryentry-interface:concept-navigationhistoryentry-index>index</a>.</p>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-samedocument data-dfn-type=attribute><code>sameDocument</code></dfn> getter steps are:</p>

  <ol><li><p>Let <var>document</var> be <a id=the-navigationhistoryentry-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-6 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window-5>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=the-navigationhistoryentry-interface:fully-active-5 href=document-sequences.html#fully-active>fully active</a>, then return false.<li><p>Return true if <a id=the-navigationhistoryentry-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she-5>session history entry</a>'s
   <a href=browsing-the-web.html#she-document id=the-navigationhistoryentry-interface:she-document-2>document</a> equals <var>document</var>, and false
   otherwise.</ol>

  <p>The <dfn data-dfn-for=NavigationHistoryEntry id=dom-navigationhistoryentry-getstate data-dfn-type=method><code>getState()</code></dfn> method steps are:</p>

  <ol><li><p>If <a id=the-navigationhistoryentry-interface:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigationhistoryentry-interface:concept-relevant-global-7 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationhistoryentry-interface:concept-document-window-6>associated <code>Document</code></a> is not <a id=the-navigationhistoryentry-interface:fully-active-6 href=document-sequences.html#fully-active>fully
   active</a>, then return undefined.<li>
    <p>Return <a id=the-navigationhistoryentry-interface:structureddeserialize-2 href=structured-data.html#structureddeserialize>StructuredDeserialize</a>(<a id=the-navigationhistoryentry-interface:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nhe-she id=the-navigationhistoryentry-interface:nhe-she-6>session
    history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-state id=the-navigationhistoryentry-interface:she-navigation-api-state>navigation API state</a>).
    Rethrow any exceptions.</p>

    <p class=note>This can in theory throw an exception, if attempting to deserialize a large
    <code id=the-navigationhistoryentry-interface:idl-arraybuffer><a data-x-internal=idl-arraybuffer href=https://webidl.spec.whatwg.org/#idl-ArrayBuffer>ArrayBuffer</a></code> when not enough memory is available.</p>
   </ol>

  

  <p>The following are the <a id=the-navigationhistoryentry-interface:event-handlers href=webappapis.html#event-handlers>event handlers</a> (and their corresponding <a href=webappapis.html#event-handler-event-type id=the-navigationhistoryentry-interface:event-handler-event-type>event handler event types</a>) that must be supported,
  as <a id=the-navigationhistoryentry-interface:event-handler-idl-attributes href=webappapis.html#event-handler-idl-attributes>event handler IDL attributes</a>, by all objects implementing the
  <code id=the-navigationhistoryentry-interface:navigationhistoryentry-9><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> interface:</p>

  <table><thead><tr><th><a href=webappapis.html#event-handlers id=the-navigationhistoryentry-interface:event-handlers-2>Event handler</a>
     <th><a id=the-navigationhistoryentry-interface:event-handler-event-type-2 href=webappapis.html#event-handler-event-type>Event handler event type</a>
   <tbody><tr><td><dfn data-dfn-for=NavigationHistoryEntry id=handler-navigationhistoryentry-ondispose data-dfn-type=attribute><code>ondispose</code></dfn>
     <td><code id=the-navigationhistoryentry-interface:event-dispose><a href=indices.html#event-dispose>dispose</a></code>
  </table>


  <h5 id=the-history-entry-list><span class=secno>7.2.6.6</span> The history entry list<a href=#the-history-entry-list class=self-link></a></h5>

  <dl class=domintro><dt><code><var>entries</var> = <a href=#dom-navigation id=the-history-entry-list:dom-navigation>navigation</a>.<a href=#dom-navigation-entries id=dom-navigation-entries-dev>entries()</a></code><dd><p>Returns an array of <code id=the-history-entry-list:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> instances represent the current
   navigation history entry list, i.e., all <a href=browsing-the-web.html#session-history-entry id=the-history-entry-list:session-history-entry>session history
   entries</a> for this <a id=the-history-entry-list:navigable href=document-sequences.html#navigable>navigable</a> that are <a id=the-history-entry-list:same-origin href=browsers.html#same-origin>same origin</a> and contiguous
   to the <a href=document-sequences.html#nav-current-history-entry id=the-history-entry-list:nav-current-history-entry>current session history entry</a>.</p>

   <dt><code><a href=#dom-navigation id=the-history-entry-list:dom-navigation-2>navigation</a>.<a href=#dom-navigation-currententry id=dom-navigation-currententry-dev>currentEntry</a></code><dd><p>Returns the <code id=the-history-entry-list:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> corresponding to the <a href=document-sequences.html#nav-current-history-entry id=the-history-entry-list:nav-current-history-entry-2>current session history entry</a>.</p>

   <dt><code><a href=#dom-navigation id=the-history-entry-list:dom-navigation-3>navigation</a>.<a href=#dom-navigation-updatecurrententry id=dom-navigation-updatecurrententry-dev>updateCurrentEntry</a>({ <a href=#dom-navigationupdatecurrententryoptions-state id=the-history-entry-list:dom-navigationupdatecurrententryoptions-state>state</a> })</code><dd>
    <p>Updates the <a href=browsing-the-web.html#she-navigation-api-state id=the-history-entry-list:she-navigation-api-state>navigation API state</a> of the <a href=document-sequences.html#nav-current-history-entry id=the-history-entry-list:nav-current-history-entry-3>current session history entry</a>, without performing a
    navigation like <code id=the-history-entry-list:dom-navigation-reload><a href=#dom-navigation-reload>navigation.reload()</a></code> would do.</p>

    <p>This method is best used to capture updates to the page that have already happened, and need
    to be reflected into the navigation API state. For cases where the state update is meant to
    drive a page update, instead use <code id=the-history-entry-list:dom-navigation-navigate><a href=#dom-navigation-navigate>navigation.navigate()</a></code> or <code id=the-history-entry-list:dom-navigation-reload-2><a href=#dom-navigation-reload>navigation.reload()</a></code>, which will trigger a <code id=the-history-entry-list:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event.</p>
   <dt><code><a href=#dom-navigation id=the-history-entry-list:dom-navigation-4>navigation</a>.<a href=#dom-navigation-cangoback id=dom-navigation-cangoback-dev>canGoBack</a></code><dd><p>Returns true if the current <a href=document-sequences.html#nav-current-history-entry id=the-history-entry-list:nav-current-history-entry-4>current session
   history entry</a> (i.e., <code id=the-history-entry-list:dom-navigation-currententry><a href=#dom-navigation-currententry>currentEntry</a></code>) is
   not the first one in the navigation history entry list (i.e., in <code id=the-history-entry-list:dom-navigation-entries><a href=#dom-navigation-entries>entries()</a></code>). This means that there is a previous
   <a id=the-history-entry-list:session-history-entry-2 href=browsing-the-web.html#session-history-entry>session history entry</a> for this <a id=the-history-entry-list:navigable-2 href=document-sequences.html#navigable>navigable</a>, and its <a href=browsing-the-web.html#she-document-state id=the-history-entry-list:she-document-state>document state</a>'s <a href=browsing-the-web.html#document-state-origin id=the-history-entry-list:document-state-origin>origin</a> is <a id=the-history-entry-list:same-origin-2 href=browsers.html#same-origin>same origin</a> with the current
   <code id=the-history-entry-list:document><a href=dom.html#document>Document</a></code>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-history-entry-list:concept-document-origin data-x-internal=concept-document-origin>origin</a>.</p>

   <dt><code><a href=#dom-navigation id=the-history-entry-list:dom-navigation-5>navigation</a>.<a href=#dom-navigation-cangoforward id=dom-navigation-cangoforward-dev>canGoForward</a></code><dd><p>Returns true if the current <a href=document-sequences.html#nav-current-history-entry id=the-history-entry-list:nav-current-history-entry-5>current session
   history entry</a> (i.e., <code id=the-history-entry-list:dom-navigation-currententry-2><a href=#dom-navigation-currententry>currentEntry</a></code>) is
   not the last one in the navigation history entry list (i.e., in <code id=the-history-entry-list:dom-navigation-entries-2><a href=#dom-navigation-entries>entries()</a></code>). This means that there is a next <a id=the-history-entry-list:session-history-entry-3 href=browsing-the-web.html#session-history-entry>session
   history entry</a> for this <a id=the-history-entry-list:navigable-3 href=document-sequences.html#navigable>navigable</a>, and its <a href=browsing-the-web.html#she-document-state id=the-history-entry-list:she-document-state-2>document state</a>'s <a href=browsing-the-web.html#document-state-origin id=the-history-entry-list:document-state-origin-2>origin</a> is <a id=the-history-entry-list:same-origin-3 href=browsers.html#same-origin>same origin</a> with the current
   <code id=the-history-entry-list:document-2><a href=dom.html#document>Document</a></code>'s <a href=https://dom.spec.whatwg.org/#concept-document-origin id=the-history-entry-list:concept-document-origin-2 data-x-internal=concept-document-origin>origin</a>.</p>
  </dl>

  

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-entries data-dfn-type=method><code>entries()</code></dfn>
  method steps are:</p>

  <ol><li><p>If <a id=the-history-entry-list:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> <a href=#has-entries-and-events-disabled id=the-history-entry-list:has-entries-and-events-disabled>has entries and events disabled</a>, then return the empty
   list.<li>
    <p>Return <a id=the-history-entry-list:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=the-history-entry-list:navigation-entry-list>entry list</a>.</p>

    <p class=note>Recall that because of Web IDL's sequence type conversion rules, this will
    create a new JavaScript array object on each call. That is, <code><a href=#dom-navigation-entries id=the-history-entry-list:dom-navigation-entries-3>navigation.entries()</a> !== <a href=#dom-navigation-entries id=the-history-entry-list:dom-navigation-entries-4>navigation.entries()</a></code>.</p>
   </ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-currententry data-dfn-type=attribute><code>currentEntry</code></dfn> getter steps are to return the
  <a href=#navigation-current-entry id=the-history-entry-list:navigation-current-entry>current entry</a> of <a id=the-history-entry-list:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.</p>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-updatecurrententry data-dfn-type=method><code>updateCurrentEntry(<var>options</var>)</code></dfn>
  method steps are:</p>

  <ol><li><p>Let <var>current</var> be the <a href=#navigation-current-entry id=the-history-entry-list:navigation-current-entry-2>current entry</a>
   of <a id=the-history-entry-list:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.<li><p>If <var>current</var> is null, then throw an <a id=the-history-entry-list:invalidstateerror href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
   <code id=the-history-entry-list:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>serializedState</var> be
   <a id=the-history-entry-list:structuredserializeforstorage href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(<var>options</var>["<code id=the-history-entry-list:dom-navigationupdatecurrententryoptions-state-2><a href=#dom-navigationupdatecurrententryoptions-state>state</a></code>"]), rethrowing any
   exceptions.<li><p>Set <var>current</var>'s <a href=#nhe-she id=the-history-entry-list:nhe-she>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-state id=the-history-entry-list:she-navigation-api-state-2>navigation API state</a> to
   <var>serializedState</var>.<li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=the-history-entry-list:concept-event-fire data-x-internal=concept-event-fire>Fire an event</a> named <code id=the-history-entry-list:event-currententrychange><a href=indices.html#event-currententrychange>currententrychange</a></code> at <a id=the-history-entry-list:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> using
   <code id=the-history-entry-list:navigationcurrententrychangeevent><a href=#navigationcurrententrychangeevent>NavigationCurrentEntryChangeEvent</a></code>, with its <code id=the-history-entry-list:dom-navigationcurrententrychangeevent-navigationtype><a href=#dom-navigationcurrententrychangeevent-navigationtype>navigationType</a></code> attribute
   initialized to null and its <code id=the-history-entry-list:dom-navigationcurrententrychangeevent-from><a href=#dom-navigationcurrententrychangeevent-from>from</a></code>
   initialized to <var>current</var>.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-cangoback data-dfn-type=attribute><code>canGoBack</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-history-entry-list:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> <a href=#has-entries-and-events-disabled id=the-history-entry-list:has-entries-and-events-disabled-2>has entries and events disabled</a>, then return
   false.<li><p><a id=the-history-entry-list:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <a id=the-history-entry-list:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=the-history-entry-list:navigation-current-entry-index>current entry index</a> is not −1.<li><p>If <a id=the-history-entry-list:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=the-history-entry-list:navigation-current-entry-index-2>current entry
   index</a> is 0, then return false.<li><p>Return true.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-cangoforward data-dfn-type=attribute><code>canGoForward</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-history-entry-list:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> <a href=#has-entries-and-events-disabled id=the-history-entry-list:has-entries-and-events-disabled-3>has entries and events disabled</a>, then return
   false.<li><p><a id=the-history-entry-list:assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <a id=the-history-entry-list:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=the-history-entry-list:navigation-current-entry-index-3>current entry index</a> is not −1.<li><p>If <a id=the-history-entry-list:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=the-history-entry-list:navigation-current-entry-index-4>current entry
   index</a> is equal to <a id=the-history-entry-list:this-12 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=the-history-entry-list:navigation-entry-list-2>entry
   list</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=the-history-entry-list:list-size data-x-internal=list-size>size</a> − 1, then return false.<li><p>Return true.</ol>

  


  <h5 id=navigation-api-initiating-navigations><span class=secno>7.2.6.7</span> Initiating navigations<a href=#navigation-api-initiating-navigations class=self-link></a></h5>

  <dl class=domintro><dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation>navigation</a>.<a href=#dom-navigation-navigate id=dom-navigation-navigate-dev>navigate</a>(<var>url</var>)</code><dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-2>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-2>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-2>navigation</a>.<a href=#dom-navigation-navigate id=navigation-api-initiating-navigations:dom-navigation-navigate>navigate</a>(<var>url</var>, <var>options</var>)</code><dd>
    <p><a href=browsing-the-web.html#navigate id=navigation-api-initiating-navigations:navigate>Navigates</a> the current page to the given <var>url</var>.
    <var>options</var> can contain the following values:</p>

    <ul><li><p><code id=dom-navigationnavigateoptions-history-dev><a href=#dom-navigationnavigateoptions-history>history</a></code> can be set to
     "<code id=navigationhistorybehavior-replace-dev><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>" to replace the current
     session history entry, instead of pushing a new one.<li><p><code id=dom-navigationoptions-info-dev><a href=#dom-navigationoptions-info>info</a></code> can be set to any value; it
     will populate the <code id=navigation-api-initiating-navigations:dom-navigateevent-info><a href=#dom-navigateevent-info>info</a></code> property of the
     corresponding <code id=navigation-api-initiating-navigations:navigateevent><a href=#navigateevent>NavigateEvent</a></code>.<li><p><code id=dom-navigationnavigateoptions-state-dev><a href=#dom-navigationnavigateoptions-state>state</a></code> can be set to any
     <a href=structured-data.html#serializable-objects id=navigation-api-initiating-navigations:serializable-objects>serializable</a> value; it will populate the state
     retrieved by <code id=navigation-api-initiating-navigations:dom-navigationhistoryentry-getstate><a href=#dom-navigationhistoryentry-getstate>navigation.currentEntry.getState()</a></code> once the
     navigation completes, for same-document navigations. (It will be ignored for navigations that
     end up cross-document.)</ul>

    <p>By default this will perform a full navigation (i.e., a cross-document navigation, unless the
    given URL differs only in a <a href=https://url.spec.whatwg.org/#concept-url-fragment id=navigation-api-initiating-navigations:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a> from the current
    one). The <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code> method can
    be used to convert it into a same-document navigation.</p>

    <p>The returned promises will behave as follows:</p>

    <ul><li><p>For navigations that get aborted, both promises will reject with an
     <a id=navigation-api-initiating-navigations:aborterror href=https://webidl.spec.whatwg.org/#aborterror data-x-internal=aborterror>"<code>AbortError</code>"</a> <code id=navigation-api-initiating-navigations:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>For same-document navigations created by using the <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-2><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code> method, <code id=navigation-api-initiating-navigations:dom-navigationresult-committed-3><a href=#dom-navigationresult-committed>committed</a></code> will fulfill after the navigation
     commits, and <code id=navigation-api-initiating-navigations:dom-navigationresult-finished-3><a href=#dom-navigationresult-finished>finished</a></code> will fulfill or
     reject according to any promsies returned by handlers passed to <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-3><a href=#dom-navigateevent-intercept>intercept()</a></code>.<li><p>For other same-document navigations (e.g., non-intercepted <a href=browsing-the-web.html#navigate-fragid id=navigation-api-initiating-navigations:navigate-fragid>fragment navigations</a>), both promises will fulfill
     immediately.<li><p>For cross-document navigations, or navigations that result in 204 or 205 <a href=https://fetch.spec.whatwg.org/#concept-response-status id=navigation-api-initiating-navigations:concept-response-status data-x-internal=concept-response-status>statuses</a> or `<code id=navigation-api-initiating-navigations:http-content-disposition><a data-x-internal=http-content-disposition href=https://httpwg.org/specs/rfc6266.html>Content-Disposition: attachment</a></code>` header fields from
     the server (and thus do not actually navigate), both promises will never settle.</ul>

    <p>In all cases, when the returned promises fulfill, it will be with the
    <code id=navigation-api-initiating-navigations:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> that was navigated to.</p>
   <dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-4>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-4>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-3>navigation</a>.<a href=#dom-navigation-reload id=dom-navigation-reload-dev>reload</a>(<var>options</var>)</code><dd>
    <p><a href=browsing-the-web.html#reload id=navigation-api-initiating-navigations:reload>Reloads</a> the current page. <var>options</var> can contain <code id=navigation-api-initiating-navigations:dom-navigationoptions-info><a href=#dom-navigationoptions-info>info</a></code> and <code id=dom-navigationreloadoptions-state-dev><a href=#dom-navigationreloadoptions-state>state</a></code>, which behave as described above.</p>

    <p>The default behavior of performing a from-network-or-cache reload of the current page can be
    overriden by the using the <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-4><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code> method. Doing so will mean
    this call only updates state or passes along the appropriate <code id=navigation-api-initiating-navigations:dom-navigationoptions-info-2><a href=#dom-navigationoptions-info>info</a></code>, plus performing whater actions the <code id=navigation-api-initiating-navigations:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event handlers see fit to carry out.</p>

    <p>The returned promises will behave as follows:</p>

    <ul><li><p>If the reload is intercepted by using the <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-5><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code> method, <code id=navigation-api-initiating-navigations:dom-navigationresult-committed-5><a href=#dom-navigationresult-committed>committed</a></code> will fulfill after the navigation
     commits, and <code id=navigation-api-initiating-navigations:dom-navigationresult-finished-5><a href=#dom-navigationresult-finished>finished</a></code> will fulfill or
     reject according to any promsies returned by handlers passed to <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-6><a href=#dom-navigateevent-intercept>intercept()</a></code>.<li><p>Otherwise, both promises will never settle.</ul>
   <dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-6>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-6>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-4>navigation</a>.<a href=#dom-navigation-traverseto id=dom-navigation-traverseto-dev>traverseTo</a>(<var>key</var>)</code><dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-7>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-7>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-5>navigation</a>.<a href=#dom-navigation-traverseto id=navigation-api-initiating-navigations:dom-navigation-traverseto>traverseTo</a>(<var>key</var>, { <a href=#dom-navigationoptions-info id=navigation-api-initiating-navigations:dom-navigationoptions-info-3>info</a> })</code><dd>
    <p><a href=browsing-the-web.html#apply-the-traverse-history-step id=navigation-api-initiating-navigations:apply-the-traverse-history-step>Traverses</a> to the closest <a id=navigation-api-initiating-navigations:session-history-entry href=browsing-the-web.html#session-history-entry>session
    history entry</a> that matches the <code id=navigation-api-initiating-navigations:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> with the given
    <var>key</var>. <code id=navigation-api-initiating-navigations:dom-navigationoptions-info-4><a href=#dom-navigationoptions-info>info</a></code> can be set to any value;
    it will populate the <code id=navigation-api-initiating-navigations:dom-navigateevent-info-2><a href=#dom-navigateevent-info>info</a></code> property of the
    corresponding <code id=navigation-api-initiating-navigations:navigateevent-2><a href=#navigateevent>NavigateEvent</a></code>.</p>

    <p>If a traversal to that <a id=navigation-api-initiating-navigations:session-history-entry-2 href=browsing-the-web.html#session-history-entry>session history entry</a> is already in progress, then this
    will return the promises for that original traversal, and <code id=navigation-api-initiating-navigations:dom-navigateevent-info-3><a href=#dom-navigateevent-info>info</a></code> will be ignored.</p>

    <p>The returned promises will behave as follows:</p>

    <ul><li><p>If there is no <code id=navigation-api-initiating-navigations:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> in <code id=navigation-api-initiating-navigations:dom-navigation-entries><a href=#dom-navigation-entries>navigation.entries()</a></code> whose <code id=navigation-api-initiating-navigations:dom-navigationhistoryentry-key><a href=#dom-navigationhistoryentry-key>key</a></code> matches <var>key</var>, both promises will
     reject with an <a id=navigation-api-initiating-navigations:invalidstateerror href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
     <code id=navigation-api-initiating-navigations:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>For same-document traversals intercepted by the <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-7><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code> method, <code id=navigation-api-initiating-navigations:dom-navigationresult-committed-8><a href=#dom-navigationresult-committed>committed</a></code> will fulfill as soon as the traversal
     is processed and <code id=navigation-api-initiating-navigations:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> is
     updated, and <code id=navigation-api-initiating-navigations:dom-navigationresult-finished-8><a href=#dom-navigationresult-finished>finished</a></code> will fulfill or
     reject according to any promsies returned by the handlers passed to <code id=navigation-api-initiating-navigations:dom-navigateevent-intercept-8><a href=#dom-navigateevent-intercept>intercept()</a></code>.<li><p>For non-intercepted same-document travesals, both promises will fulfill as soon as the
     traversal is processed and <code id=navigation-api-initiating-navigations:dom-navigation-currententry-2><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> is updated.<li><p>For cross-document traversals, including attempted cross-document traversals that end up
     resulting in a 204 or 205 <a href=https://fetch.spec.whatwg.org/#concept-response-status id=navigation-api-initiating-navigations:concept-response-status-2 data-x-internal=concept-response-status>statuses</a> or `<code id=navigation-api-initiating-navigations:http-content-disposition-2><a data-x-internal=http-content-disposition href=https://httpwg.org/specs/rfc6266.html>Content-Disposition: attachment</a></code>` header fields from
     the server (and thus do not actually traverse), both promises will never settle.</ul>
   <dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-9>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-9>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-6>navigation</a>.<a href=#dom-navigation-back id=dom-navigation-back-dev>back</a>(<var>key</var>)</code><dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-10>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-10>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-7>navigation</a>.<a href=#dom-navigation-back id=navigation-api-initiating-navigations:dom-navigation-back>back</a>(<var>key</var>, { <a href=#dom-navigationoptions-info id=navigation-api-initiating-navigations:dom-navigationoptions-info-5>info</a> })</code><dd>
    <p>Traverses to the closest previous <a id=navigation-api-initiating-navigations:session-history-entry-3 href=browsing-the-web.html#session-history-entry>session history entry</a> which results in this
    <a id=navigation-api-initiating-navigations:navigable href=document-sequences.html#navigable>navigable</a> traversing, i.e., which corresponds to a different
    <code id=navigation-api-initiating-navigations:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> and thus will cause <code id=navigation-api-initiating-navigations:dom-navigation-currententry-3><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> to change. <code id=navigation-api-initiating-navigations:dom-navigationoptions-info-6><a href=#dom-navigationoptions-info>info</a></code> can be set to any value; it will populate the
    <code id=navigation-api-initiating-navigations:dom-navigateevent-info-4><a href=#dom-navigateevent-info>info</a></code> property of the corresponding
    <code id=navigation-api-initiating-navigations:navigateevent-3><a href=#navigateevent>NavigateEvent</a></code>.</p>

    <p>If a traversal to that <a id=navigation-api-initiating-navigations:session-history-entry-4 href=browsing-the-web.html#session-history-entry>session history entry</a> is already in progress, then this
    will return the promises for that original traversal, and <code id=navigation-api-initiating-navigations:dom-navigateevent-info-5><a href=#dom-navigateevent-info>info</a></code> will be ignored.</p>

    <p>The returned promises behave equivalently to those returned by <code id=navigation-api-initiating-navigations:dom-navigation-traverseto-2><a href=#dom-navigation-traverseto>traverseTo()</a></code>.</p>
   <dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-11>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-11>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-8>navigation</a>.<a href=#dom-navigation-forward id=dom-navigation-forward-dev>forward</a>(<var>key</var>)</code><dt><code>{ <a href=#dom-navigationresult-committed id=navigation-api-initiating-navigations:dom-navigationresult-committed-12>committed</a>, <a href=#dom-navigationresult-finished id=navigation-api-initiating-navigations:dom-navigationresult-finished-12>finished</a> } = <a href=#dom-navigation id=navigation-api-initiating-navigations:dom-navigation-9>navigation</a>.<a href=#dom-navigation-forward id=navigation-api-initiating-navigations:dom-navigation-forward>forward</a>(<var>key</var>, { <a href=#dom-navigationoptions-info id=navigation-api-initiating-navigations:dom-navigationoptions-info-7>info</a> })</code><dd>
    <p>Traverses to the closest forward <a id=navigation-api-initiating-navigations:session-history-entry-5 href=browsing-the-web.html#session-history-entry>session history entry</a> which results in this
    <a id=navigation-api-initiating-navigations:navigable-2 href=document-sequences.html#navigable>navigable</a> traversing, i.e., which corresponds to a different
    <code id=navigation-api-initiating-navigations:navigationhistoryentry-5><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> and thus will cause <code id=navigation-api-initiating-navigations:dom-navigation-currententry-4><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> to change. <code id=navigation-api-initiating-navigations:dom-navigationoptions-info-8><a href=#dom-navigationoptions-info>info</a></code> can be set to any value; it will populate the
    <code id=navigation-api-initiating-navigations:dom-navigateevent-info-6><a href=#dom-navigateevent-info>info</a></code> property of the corresponding
    <code id=navigation-api-initiating-navigations:navigateevent-4><a href=#navigateevent>NavigateEvent</a></code>.</p>

    <p>If a traversal to that <a id=navigation-api-initiating-navigations:session-history-entry-6 href=browsing-the-web.html#session-history-entry>session history entry</a> is already in progress, then this
    will return the promises for that original traversal, and <code id=navigation-api-initiating-navigations:dom-navigateevent-info-7><a href=#dom-navigateevent-info>info</a></code> will be ignored.</p>

    <p>The returned promises behave equivalently to those returned by <code id=navigation-api-initiating-navigations:dom-navigation-traverseto-3><a href=#dom-navigation-traverseto>traverseTo()</a></code>.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-navigate data-dfn-type=method><code>navigate(<var>url</var>, <var>options</var>)</code></dfn> method
  steps are:</p>

  <ol><li><p>Let <var>urlRecord</var> be the result of <a href=urls-and-fetching.html#parse-a-url id=navigation-api-initiating-navigations:parse-a-url>parsing a URL</a>
   given <var>url</var>, relative to <a id=navigation-api-initiating-navigations:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=navigation-api-initiating-navigations:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings
   object</a>.<li><p>If <var>urlRecord</var> is failure, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result>early error result</a> for a
   <a id=navigation-api-initiating-navigations:syntaxerror href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>urlRecord</var>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=navigation-api-initiating-navigations:concept-url-scheme data-x-internal=concept-url-scheme>scheme</a> is "<code id=navigation-api-initiating-navigations:the-javascript:-url-special-case><a href=browsing-the-web.html#the-javascript:-url-special-case>javascript</a></code>", then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-2>early error result</a> for a
   <a id=navigation-api-initiating-navigations:notsupportederror href=https://webidl.spec.whatwg.org/#notsupportederror data-x-internal=notsupportederror>"<code>NotSupportedError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

   <li><p>Let <var>document</var> be <a id=navigation-api-initiating-navigations:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=navigation-api-initiating-navigations:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=navigation-api-initiating-navigations:concept-document-window>associated <code>Document</code></a>.<li><p>If <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationnavigateoptions-history><a href=#dom-navigationnavigateoptions-history>history</a></code>"] is "<code id=navigation-api-initiating-navigations:navigationhistorybehavior-push><a href=browsing-the-web.html#navigationhistorybehavior-push>push</a></code>", and <a id=navigation-api-initiating-navigations:the-navigation-must-be-a-replace href=browsing-the-web.html#the-navigation-must-be-a-replace>the navigation must be a
   replace</a> given <var>urlRecord</var> and <var>document</var>, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-3>early error result</a> for a
   <a id=navigation-api-initiating-navigations:notsupportederror-2 href=https://webidl.spec.whatwg.org/#notsupportederror data-x-internal=notsupportederror>"<code>NotSupportedError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-5><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

   <li><p>Let <var>state</var> be <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationnavigateoptions-state><a href=#dom-navigationnavigateoptions-state>state</a></code>"], if it <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists data-x-internal=map-exists>exists</a>; otherwise, undefined.<li>
    <p>Let <var>serializedState</var> be
    <a id=navigation-api-initiating-navigations:structuredserializeforstorage href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(<var>state</var>). If this throws an exception, then
    return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-4>early error result</a> for that
    exception.</p>

    <p class=note>It is important to perform this step early, since serialization can invoke web
    developer code, which in turn might change various things we check in later steps.</p>
   <li><p>If <var>document</var> is not <a id=navigation-api-initiating-navigations:fully-active href=document-sequences.html#fully-active>fully active</a>, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-5>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-2 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-6><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

   <li><p>If <var>document</var>'s <a id=navigation-api-initiating-navigations:unload-counter href=document-lifecycle.html#unload-counter>unload counter</a> is greater than 0, then return an
   <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-6>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-3 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-7><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>info</var> be <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationoptions-info-9><a href=#dom-navigationoptions-info>info</a></code>"], if it <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists-2 data-x-internal=map-exists>exists</a>;
   otherwise, undefined.<li><p>Let <var>apiMethodTracker</var> be the result of <a href=#maybe-set-the-upcoming-non-traverse-api-method-tracker id=navigation-api-initiating-navigations:maybe-set-the-upcoming-non-traverse-api-method-tracker>maybe setting the upcoming non-traverse API method
   tracker</a> for <a id=navigation-api-initiating-navigations:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> given <var>info</var> and
   <var>serializedState</var>.<li>
    <p><a id=navigation-api-initiating-navigations:navigate-2 href=browsing-the-web.html#navigate>Navigate</a> <var>document</var>'s <a id=navigation-api-initiating-navigations:node-navigable href=document-sequences.html#node-navigable>node
    navigable</a> to <var>urlRecord</var> using <var>document</var>, with <i id=navigation-api-initiating-navigations:navigation-hh><a href=browsing-the-web.html#navigation-hh>historyHandling</a></i> set to <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationnavigateoptions-history-2><a href=#dom-navigationnavigateoptions-history>history</a></code>"] and <i id=navigation-api-initiating-navigations:navigation-navigation-api-state><a href=browsing-the-web.html#navigation-navigation-api-state>navigationAPIState</a></i> set to
    <var>serializedState</var>.</p>

    <p class=note>Unlike <code id=navigation-api-initiating-navigations:dom-location-assign><a href=#dom-location-assign>location.assign()</a></code> and friends,
    which are exposed across <a href=browsers.html#same-origin-domain id=navigation-api-initiating-navigations:same-origin-domain>origin-domain</a> boundaries,
    <code id=navigation-api-initiating-navigations:dom-navigation-navigate-2><a href=#dom-navigation-navigate>navigation.navigate()</a></code> can only be accessed by code
    with direct synchronous access to the <code id=navigation-api-initiating-navigations:dom-navigation-10><a href=#dom-navigation>window.navigation</a></code>
    property. Thus, we avoid the complications about attributing the source document of the
    navigation, and we don't need to deal with the <a id=navigation-api-initiating-navigations:allowed-to-navigate href=browsing-the-web.html#allowed-to-navigate>allowed by sandboxing to navigate</a>
    check and its acccompanying <i id=navigation-api-initiating-navigations:exceptions-enabled><a href=browsing-the-web.html#exceptions-enabled>exceptionsEnabled</a></i> flag. We just
    treat all navigations as if they come from the <code id=navigation-api-initiating-navigations:document><a href=dom.html#document>Document</a></code> corresponding to this
    <code id=navigation-api-initiating-navigations:navigation><a href=#navigation>Navigation</a></code> object itself (i.e., <var>document</var>).</p>
   <li>
    <p>If <a id=navigation-api-initiating-navigations:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#upcoming-non-traverse-api-method-tracker id=navigation-api-initiating-navigations:upcoming-non-traverse-api-method-tracker>upcoming non-traverse API method tracker</a> is
    <var>apiMethodTracker</var>, then:</p>

    <p class=note>If the <a href=#upcoming-non-traverse-api-method-tracker id=navigation-api-initiating-navigations:upcoming-non-traverse-api-method-tracker-2>upcoming non-traverse API method tracker</a> is still
    <var>apiMethodTracker</var>, this means that the <a id=navigation-api-initiating-navigations:navigate-3 href=browsing-the-web.html#navigate>navigate</a> algorithm bailed out
    before ever getting to the <a href=#inner-navigate-event-firing-algorithm id=navigation-api-initiating-navigations:inner-navigate-event-firing-algorithm>inner <code>navigate</code> event
    firing algorithm</a> which would <a href=#promote-an-upcoming-api-method-tracker-to-ongoing id=navigation-api-initiating-navigations:promote-an-upcoming-api-method-tracker-to-ongoing>promote that upcoming API method tracker to ongoing</a>.</p>

    <ol><li><p>Set <a id=navigation-api-initiating-navigations:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#upcoming-non-traverse-api-method-tracker id=navigation-api-initiating-navigations:upcoming-non-traverse-api-method-tracker-3>upcoming non-traverse API method tracker</a> to
     null.<li><p>Return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-7>early error result</a> for
     an <a id=navigation-api-initiating-navigations:aborterror-2 href=https://webidl.spec.whatwg.org/#aborterror data-x-internal=aborterror>"<code>AbortError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-8><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>
   <li><p>Return a <a href=#navigation-api-method-tracker-derived-result id=navigation-api-initiating-navigations:navigation-api-method-tracker-derived-result>navigation API method tracker-derived result</a> for
   <var>apiMethodTracker</var>.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-reload data-dfn-type=method><code>reload(<var>options</var>)</code></dfn> method steps are:</p>

  <ol><li><p>Let <var>document</var> be <a id=navigation-api-initiating-navigations:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=navigation-api-initiating-navigations:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=navigation-api-initiating-navigations:concept-document-window-2>associated <code>Document</code></a>.<li><p>Let <var>serializedState</var> be
   <a id=navigation-api-initiating-navigations:structuredserializeforstorage-2 href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(undefined).<li>
    <p>If <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationreloadoptions-state><a href=#dom-navigationreloadoptions-state>state</a></code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists-3 data-x-internal=map-exists>exists</a>, then set <var>serializedState</var> to
    <a id=navigation-api-initiating-navigations:structuredserializeforstorage-3 href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(<var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationreloadoptions-state-2><a href=#dom-navigationreloadoptions-state>state</a></code>"]). If this throws an exception, then
    return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-8>early error result</a> for that
    exception.</p>

    <p class=note>It is important to perform this step early, since serialization can invoke web
    developer code, which in turn might change various things we check in later steps.</p>
   <li>
    <p>Otherwise:</p>

    <ol><li><p>Let <var>current</var> be the <a href=#navigation-current-entry id=navigation-api-initiating-navigations:navigation-current-entry>current
     entry</a> of <a id=navigation-api-initiating-navigations:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.<li><p>If <var>current</var> is not null, then set <var>serializedState</var> to
     <var>current</var>'s <a href=#nhe-she id=navigation-api-initiating-navigations:nhe-she>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-state id=navigation-api-initiating-navigations:she-navigation-api-state>navigation API state</a>.</ol>
   <li><p>If <var>document</var> is not <a id=navigation-api-initiating-navigations:fully-active-2 href=document-sequences.html#fully-active>fully active</a>, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-9>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-4 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-9><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

   <li><p>If <var>document</var>'s <a id=navigation-api-initiating-navigations:unload-counter-2 href=document-lifecycle.html#unload-counter>unload counter</a> is greater than 0, then return an
   <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-10>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-5 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-10><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>info</var> be <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationoptions-info-10><a href=#dom-navigationoptions-info>info</a></code>"], if it <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists-4 data-x-internal=map-exists>exists</a>;
   otherwise, undefined.<li><p>Let <var>apiMethodTracker</var> be the result of <a href=#maybe-set-the-upcoming-non-traverse-api-method-tracker id=navigation-api-initiating-navigations:maybe-set-the-upcoming-non-traverse-api-method-tracker-2>maybe setting the upcoming non-traverse API method
   tracker</a> for <a id=navigation-api-initiating-navigations:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a> given <var>info</var> and
   <var>serializedState</var>.<li><p><a id=navigation-api-initiating-navigations:reload-2 href=browsing-the-web.html#reload>Reload</a> <var>document</var>'s <a id=navigation-api-initiating-navigations:node-navigable-2 href=document-sequences.html#node-navigable>node navigable</a> with <i id=navigation-api-initiating-navigations:reload-navigation-api-state><a href=browsing-the-web.html#reload-navigation-api-state>navigationAPIState</a></i> set to
   <var>serializedState</var>.<li><p>Return a <a href=#navigation-api-method-tracker-derived-result id=navigation-api-initiating-navigations:navigation-api-method-tracker-derived-result-2>navigation API method tracker-derived result</a> for
   <var>apiMethodTracker</var>.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-traverseto data-dfn-type=method><code>traverseTo(<var>key</var>, <var>options</var>)</code></dfn>
  method steps are:</p>

  <ol><li><p>If <a id=navigation-api-initiating-navigations:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=navigation-api-initiating-navigations:navigation-current-entry-index>current entry
   index</a> is −1, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-11>early
   error result</a> for an <a id=navigation-api-initiating-navigations:invalidstateerror-6 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
   <code id=navigation-api-initiating-navigations:domexception-11><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=navigation-api-initiating-navigations:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=navigation-api-initiating-navigations:navigation-entry-list>entry list</a> does not
   <a href=https://infra.spec.whatwg.org/#list-contain id=navigation-api-initiating-navigations:list-contains data-x-internal=list-contains>contain</a> a <code id=navigation-api-initiating-navigations:navigationhistoryentry-6><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> whose <a href=#nhe-she id=navigation-api-initiating-navigations:nhe-she-2>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-key id=navigation-api-initiating-navigations:she-navigation-api-key>navigation
   API key</a> equals <var>key</var>, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-12>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-7 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-12><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Return the result of <a href=#performing-a-navigation-api-traversal id=navigation-api-initiating-navigations:performing-a-navigation-api-traversal>performing a navigation API traversal</a> given
   <a id=navigation-api-initiating-navigations:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, <var>key</var>, and <var>options</var>.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-back data-dfn-type=method><code>back(<var>options</var>)</code></dfn> method steps are:</p>

  <ol><li><p>If <a id=navigation-api-initiating-navigations:this-12 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=navigation-api-initiating-navigations:navigation-current-entry-index-2>current entry
   index</a> is −1 or 0, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-13>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-8 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-13><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>key</var> be <a id=navigation-api-initiating-navigations:this-13 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=navigation-api-initiating-navigations:navigation-entry-list-2>entry
   list</a>[<a id=navigation-api-initiating-navigations:this-14 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=navigation-api-initiating-navigations:navigation-current-entry-index-3>current entry
   index</a> − 1]'s <a href=#nhe-she id=navigation-api-initiating-navigations:nhe-she-3>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-key id=navigation-api-initiating-navigations:she-navigation-api-key-2>navigation API key</a>.<li><p>Return the result of <a href=#performing-a-navigation-api-traversal id=navigation-api-initiating-navigations:performing-a-navigation-api-traversal-2>performing a navigation API traversal</a> given
   <a id=navigation-api-initiating-navigations:this-15 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, <var>key</var>, and <var>options</var>.</ol>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-forward data-dfn-type=method><code>forward(<var>options</var>)</code></dfn> method steps are:</p>

  <ol><li><p>If <a id=navigation-api-initiating-navigations:this-16 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=navigation-api-initiating-navigations:navigation-current-entry-index-4>current entry
   index</a> is −1 or is equal to <a id=navigation-api-initiating-navigations:this-17 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=navigation-api-initiating-navigations:navigation-entry-list-3>entry list</a>'s <a href=https://infra.spec.whatwg.org/#list-size id=navigation-api-initiating-navigations:list-size data-x-internal=list-size>size</a> −
   1, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-14>early error result</a> for
   an <a id=navigation-api-initiating-navigations:invalidstateerror-9 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-14><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>key</var> be <a id=navigation-api-initiating-navigations:this-18 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-entry-list id=navigation-api-initiating-navigations:navigation-entry-list-4>entry
   list</a>[<a id=navigation-api-initiating-navigations:this-19 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-current-entry-index id=navigation-api-initiating-navigations:navigation-current-entry-index-5>current entry
   index</a> + 1]'s <a href=#nhe-she id=navigation-api-initiating-navigations:nhe-she-4>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-key id=navigation-api-initiating-navigations:she-navigation-api-key-3>navigation API key</a>.<li><p>Return the result of <a href=#performing-a-navigation-api-traversal id=navigation-api-initiating-navigations:performing-a-navigation-api-traversal-3>performing a navigation API traversal</a> given
   <a id=navigation-api-initiating-navigations:this-20 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>, <var>key</var>, and <var>options</var>.</ol>

  <p>To <dfn id=performing-a-navigation-api-traversal>perform a navigation API traversal</dfn>
  given a <code id=navigation-api-initiating-navigations:navigation-2><a href=#navigation>Navigation</a></code> <var>navigation</var>, a string <var>key</var>, and a
  <code id=navigation-api-initiating-navigations:navigationoptions><a href=#navigationoptions>NavigationOptions</a></code> <var>options</var>:</p>

  <ol><li><p>Let <var>document</var> be <var>navigation</var>'s <a id=navigation-api-initiating-navigations:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#concept-document-window id=navigation-api-initiating-navigations:concept-document-window-3>associated <code>Document</code></a>.<li><p>If <var>document</var> is not <a id=navigation-api-initiating-navigations:fully-active-3 href=document-sequences.html#fully-active>fully active</a>, then return an <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-15>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-10 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-15><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

   <li><p>If <var>document</var>'s <a id=navigation-api-initiating-navigations:unload-counter-3 href=document-lifecycle.html#unload-counter>unload counter</a> is greater than 0, then return an
   <a href=#navigation-api-early-error-result id=navigation-api-initiating-navigations:navigation-api-early-error-result-16>early error result</a> for an
   <a id=navigation-api-initiating-navigations:invalidstateerror-11 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-16><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>current</var> be the <a href=#navigation-current-entry id=navigation-api-initiating-navigations:navigation-current-entry-2>current entry</a>
   of <var>navigation</var>.<li><p>If <var>key</var> equals <var>current</var>'s <a href=#nhe-she id=navigation-api-initiating-navigations:nhe-she-5>session history
   entry</a>'s <a href=browsing-the-web.html#she-navigation-api-key id=navigation-api-initiating-navigations:she-navigation-api-key-4>navigation API key</a>, then return «[
   "<code id=navigation-api-initiating-navigations:dom-navigationresult-committed-13><a href=#dom-navigationresult-committed>committed</a></code>" → <a id=navigation-api-initiating-navigations:a-promise-resolved-with href=https://webidl.spec.whatwg.org/#a-promise-resolved-with data-x-internal=a-promise-resolved-with>a promise resolved
   with</a> <var>current</var>, "<code id=navigation-api-initiating-navigations:dom-navigationresult-finished-13><a href=#dom-navigationresult-finished>finished</a></code>"
   → <a id=navigation-api-initiating-navigations:a-promise-resolved-with-2 href=https://webidl.spec.whatwg.org/#a-promise-resolved-with data-x-internal=a-promise-resolved-with>a promise resolved with</a> <var>current</var> ]».<li><p>If <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=navigation-api-initiating-navigations:upcoming-traverse-api-method-trackers>upcoming traverse API method
   trackers</a>[<var>key</var>] <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists-5 data-x-internal=map-exists>exists</a>, then return a
   <a href=#navigation-api-method-tracker-derived-result id=navigation-api-initiating-navigations:navigation-api-method-tracker-derived-result-3>navigation API method tracker-derived result</a> for <var>navigation</var>'s
   <a href=#upcoming-traverse-api-method-trackers id=navigation-api-initiating-navigations:upcoming-traverse-api-method-trackers-2>upcoming traverse API method trackers</a>[<var>key</var>].<li><p>Let <var>info</var> be <var>options</var>["<code id=navigation-api-initiating-navigations:dom-navigationoptions-info-11><a href=#dom-navigationoptions-info>info</a></code>"], if it <a href=https://infra.spec.whatwg.org/#map-exists id=navigation-api-initiating-navigations:map-exists-6 data-x-internal=map-exists>exists</a>;
   otherwise, undefined.<li><p>Let <var>apiMethodTracker</var> be the result of <a href=#add-an-upcoming-traverse-api-method-tracker id=navigation-api-initiating-navigations:add-an-upcoming-traverse-api-method-tracker>adding an upcoming traverse API method tracker</a> for
   <var>navigation</var> given <var>key</var> and <var>info</var>.<li><p>Let <var>navigable</var> be <var>document</var>'s <a id=navigation-api-initiating-navigations:node-navigable-3 href=document-sequences.html#node-navigable>node navigable</a>.<li><p>Let <var>traversable</var> be <var>navigable</var>'s <a href=document-sequences.html#nav-traversable id=navigation-api-initiating-navigations:nav-traversable>traversable navigable</a>.<li><p>Let <var>sourceSnapshotParams</var> be the result of <a id=navigation-api-initiating-navigations:snapshotting-source-snapshot-params href=browsing-the-web.html#snapshotting-source-snapshot-params>snapshotting source snapshot
   params</a> given <var>document</var>.<li>
    <p><a href=browsing-the-web.html#tn-append-session-history-traversal-steps id=navigation-api-initiating-navigations:tn-append-session-history-traversal-steps>Append the following session history
    traversal steps</a> to <var>traversable</var>:</p>

    <ol><li><p>Let <var>navigableSHEs</var> be the result of <a id=navigation-api-initiating-navigations:getting-session-history-entries href=browsing-the-web.html#getting-session-history-entries>getting session history
     entries</a> given <var>navigable</var>.<li>
      <p>Let <var>targetSHE</var> be the <a id=navigation-api-initiating-navigations:session-history-entry-7 href=browsing-the-web.html#session-history-entry>session history entry</a> in
      <var>navigableSHEs</var> whose <a href=browsing-the-web.html#she-navigation-api-key id=navigation-api-initiating-navigations:she-navigation-api-key-5>navigation API key</a>
      is <var>key</var>. If no such entry exists, then:</p>

      <ol><li><p><a id=navigation-api-initiating-navigations:queue-a-global-task href=webappapis.html#queue-a-global-task>Queue a global task</a> on the <a id=navigation-api-initiating-navigations:navigation-and-traversal-task-source href=webappapis.html#navigation-and-traversal-task-source>navigation and traversal task
       source</a> given <var>navigation</var>'s <a id=navigation-api-initiating-navigations:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a> to
       <a href=#reject-the-finished-promise id=navigation-api-initiating-navigations:reject-the-finished-promise>reject the finished promise</a> for <var>apiMethodTracker</var> with an
       <a id=navigation-api-initiating-navigations:invalidstateerror-12 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-17><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Abort these steps.</ol>

      <p class=note>This path is taken if <var>navigation</var>'s <a href=#navigation-entry-list id=navigation-api-initiating-navigations:navigation-entry-list-5>entry list</a> was outdated compared to
      <var>navigableSHEs</var>, which can occur for brief periods while all the relevant threads and
      processes are being synchronized in reaction to a history change.</p>
     <li>
      <p>If <var>targetSHE</var> is <var>navigable</var>'s <a href=document-sequences.html#nav-active-history-entry id=navigation-api-initiating-navigations:nav-active-history-entry>active session history entry</a>, then abort these
      steps.</p>

      <p class=note>This can occur if a previously <a href=browsing-the-web.html#tn-append-session-history-traversal-steps id=navigation-api-initiating-navigations:tn-append-session-history-traversal-steps-2>queued</a> traversal already took us to
      this <a id=navigation-api-initiating-navigations:session-history-entry-8 href=browsing-the-web.html#session-history-entry>session history entry</a>. In that case the previous traversal will have dealt
      with <var>apiMethodTracker</var> already.</p>
     <li><p>Let <var>result</var> be the result of <a href=browsing-the-web.html#apply-the-traverse-history-step id=navigation-api-initiating-navigations:apply-the-traverse-history-step-2>applying the traverse history step</a> given by <var>targetSHE</var>'s <a href=browsing-the-web.html#she-step id=navigation-api-initiating-navigations:she-step>step</a> to <var>traversable</var>, given <var>sourceSnapshotParams</var>,
     <var>navigable</var>, and "<code id=navigation-api-initiating-navigations:uni-none><a href=browsing-the-web.html#uni-none>none</a></code>".<li><p>If <var>result</var> is "<code>canceled-by-beforeunload</code>", then
     <a id=navigation-api-initiating-navigations:queue-a-global-task-2 href=webappapis.html#queue-a-global-task>queue a global task</a> on the <a id=navigation-api-initiating-navigations:navigation-and-traversal-task-source-2 href=webappapis.html#navigation-and-traversal-task-source>navigation and traversal task source</a> given
     <var>navigation</var>'s <a id=navigation-api-initiating-navigations:concept-relevant-global-5 href=webappapis.html#concept-relevant-global>relevant global object</a> to <a href=#reject-the-finished-promise id=navigation-api-initiating-navigations:reject-the-finished-promise-2>reject the finished
     promise</a> for <var>apiMethodTracker</var> with a new
     <a id=navigation-api-initiating-navigations:aborterror-3 href=https://webidl.spec.whatwg.org/#aborterror data-x-internal=aborterror>"<code>AbortError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-18><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> created in
     <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigation-api-initiating-navigations:concept-relevant-realm>relevant realm</a>.<li>
      <p>If <var>result</var> is "<code>initiator-disallowed</code>", then <a id=navigation-api-initiating-navigations:queue-a-global-task-3 href=webappapis.html#queue-a-global-task>queue a
      global task</a> on the <a id=navigation-api-initiating-navigations:navigation-and-traversal-task-source-3 href=webappapis.html#navigation-and-traversal-task-source>navigation and traversal task source</a> given
      <var>navigation</var>'s <a id=navigation-api-initiating-navigations:concept-relevant-global-6 href=webappapis.html#concept-relevant-global>relevant global object</a> to <a href=#reject-the-finished-promise id=navigation-api-initiating-navigations:reject-the-finished-promise-3>reject the finished
      promise</a> for <var>apiMethodTracker</var> with a new
      <a id=navigation-api-initiating-navigations:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=navigation-api-initiating-navigations:domexception-19><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> created in
      <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigation-api-initiating-navigations:concept-relevant-realm-2>relevant realm</a>.</p>

      <div class=note>
       <p>When <var>result</var> is "<code>canceled-by-beforeunload</code>" or "<code>initiator-disallowed</code>", the <code id=navigation-api-initiating-navigations:event-navigate-2><a href=indices.html#event-navigate>navigate</a></code>
       event was never fired, <a href=#abort-the-ongoing-navigation id=navigation-api-initiating-navigations:abort-the-ongoing-navigation>aborting the ongoing
       navigation</a> would not be correct; it would result in a <code id=navigation-api-initiating-navigations:event-navigateerror><a href=indices.html#event-navigateerror>navigateerror</a></code> event without a preceding <code id=navigation-api-initiating-navigations:event-navigate-3><a href=indices.html#event-navigate>navigate</a></code> event.</p>

       <p>In the "<code>canceled-by-navigate</code>" case, <code id=navigation-api-initiating-navigations:event-navigate-4><a href=indices.html#event-navigate>navigate</a></code> <em>is</em> fired, but the <a href=#inner-navigate-event-firing-algorithm id=navigation-api-initiating-navigations:inner-navigate-event-firing-algorithm-2>inner <code>navigate</code> event firing algorithm</a> will take care of
       <a href=#abort-the-ongoing-navigation id=navigation-api-initiating-navigations:abort-the-ongoing-navigation-2>aborting the ongoing navigation</a>.</p>
      </div>
     </ol>
   <li><p>Return a <a href=#navigation-api-method-tracker-derived-result id=navigation-api-initiating-navigations:navigation-api-method-tracker-derived-result-4>navigation API method tracker-derived result</a> for
   <var>apiMethodTracker</var>.</ol>

  <p>An <dfn id=navigation-api-early-error-result>early error result</dfn> for an exception
  <var>e</var> is a <code id=navigation-api-initiating-navigations:navigationresult><a href=#navigationresult>NavigationResult</a></code> dictionary instance given by «[ "<code id=navigation-api-initiating-navigations:dom-navigationresult-committed-14><a href=#dom-navigationresult-committed>committed</a></code>" → <a id=navigation-api-initiating-navigations:a-promise-rejected-with href=https://webidl.spec.whatwg.org/#a-promise-rejected-with data-x-internal=a-promise-rejected-with>a promise rejected with</a>
  <var>e</var>, "<code id=navigation-api-initiating-navigations:dom-navigationresult-finished-14><a href=#dom-navigationresult-finished>finished</a></code>" → <a id=navigation-api-initiating-navigations:a-promise-rejected-with-2 href=https://webidl.spec.whatwg.org/#a-promise-rejected-with data-x-internal=a-promise-rejected-with>a promise
  rejected with</a> <var>e</var> ]».</p>

  <p>A <dfn id=navigation-api-method-tracker-derived-result>navigation API method tracker-derived result</dfn> for a <a href=#navigation-api-method-tracker id=navigation-api-initiating-navigations:navigation-api-method-tracker>navigation API method
  tracker</a> is a <code id=navigation-api-initiating-navigations:navigationresult-2><a href=#navigationresult>NavigationResult</a></code> dictionary instance given by «[ "<code id=navigation-api-initiating-navigations:dom-navigationresult-committed-15><a href=#dom-navigationresult-committed>committed</a></code>" → <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed id=navigation-api-initiating-navigations:navigation-api-method-tracker-committed>committed promise</a>, "<code id=navigation-api-initiating-navigations:dom-navigationresult-finished-15><a href=#dom-navigationresult-finished>finished</a></code>" → <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-finished id=navigation-api-initiating-navigations:navigation-api-method-tracker-finished>finished promise</a> ]».</p>

  


  <h5 id=ongoing-navigation-tracking><span class=secno>7.2.6.8</span> Ongoing navigation tracking<a href=#ongoing-navigation-tracking class=self-link></a></h5>

  

  <p>During any given navigation (in the <a href=#navigationtype id=ongoing-navigation-tracking:navigationtype>broad sense of the
  word</a>), the <code id=ongoing-navigation-tracking:navigation><a href=#navigation>Navigation</a></code> object needs to keep track of the following:</p>

  <table><caption>For all navigations</caption><thead><tr><th>State
     <th>Duration
     <th>Explanation
   <tbody><tr><td>The <code id=ongoing-navigation-tracking:navigateevent><a href=#navigateevent>NavigateEvent</a></code>
     <td>For the duration of event firing
     <td>So that if the navigation is canceled while the event is firing, we can <a href=https://dom.spec.whatwg.org/#canceled-flag id=ongoing-navigation-tracking:canceled-flag data-x-internal=canceled-flag>cancel</a> the event
    <tr><td>The event's <a href=#concept-navigateevent-abort-controller id=ongoing-navigation-tracking:concept-navigateevent-abort-controller>abort controller</a>
     <td>Until all promises returned from handlers passed to <code id=ongoing-navigation-tracking:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>intercept()</a></code> have settled
     <td>So that if the navigation is canceled, we can <a id=ongoing-navigation-tracking:signal-abort href=https://dom.spec.whatwg.org/#abortcontroller-signal-abort data-x-internal=signal-abort>signal abort</a>
    <tr><td>Whether a new element was <a href=interaction.html#focusing-steps id=ongoing-navigation-tracking:focusing-steps>focused</a>
     <td>Until all promises returned from handlers passed to <code id=ongoing-navigation-tracking:dom-navigateevent-intercept-2><a href=#dom-navigateevent-intercept>intercept()</a></code> have settled
     <td>So that if one was, focus is not <a href=#potentially-reset-the-focus id=ongoing-navigation-tracking:potentially-reset-the-focus>reset</a>
    <tr><td>The <code id=ongoing-navigation-tracking:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> being navigated to
     <td>From when it is determined, until all promises returned from handlers passed to <code id=ongoing-navigation-tracking:dom-navigateevent-intercept-3><a href=#dom-navigateevent-intercept>intercept()</a></code> have settled
     <td>So that we know what to resolve any <code id=ongoing-navigation-tracking:dom-navigationresult-committed><a href=#dom-navigationresult-committed>committed</a></code> and <code id=ongoing-navigation-tracking:dom-navigationresult-finished><a href=#dom-navigationresult-finished>finished</a></code> promises with
    <tr><td>Any <code id=ongoing-navigation-tracking:dom-navigationresult-finished-2><a href=#dom-navigationresult-finished>finished</a></code> promise that was returned
     <td>Until all promises returned from handlers passed to <code id=ongoing-navigation-tracking:dom-navigateevent-intercept-4><a href=#dom-navigateevent-intercept>intercept()</a></code> have settled
     <td>So that we can resolve or reject it appropriately
  </table>

  <table><caption>For non-"<code id=ongoing-navigation-tracking:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations</caption><thead><tr><th>State
     <th>Duration
     <th>Explanation
   <tbody><tr><td>Any <code id=ongoing-navigation-tracking:dom-navigationnavigateoptions-state><a href=#dom-navigationnavigateoptions-state>state</a></code>
     <td>For the duration of event firing
     <td>So that we can update the current entry's <a href=browsing-the-web.html#she-navigation-api-state id=ongoing-navigation-tracking:she-navigation-api-state>navigation API state</a> if the event finishes firing without being <a href=https://dom.spec.whatwg.org/#canceled-flag id=ongoing-navigation-tracking:canceled-flag-2 data-x-internal=canceled-flag>canceled</a>
  </table>

  <table><caption>For "<code id=ongoing-navigation-tracking:dom-navigationtype-traverse-2><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations</caption><thead><tr><th>State
     <th>Duration
     <th>Explanation
   <tbody><tr><td>Any <code id=ongoing-navigation-tracking:dom-navigationoptions-info><a href=#dom-navigationoptions-info>info</a></code>
     <td>Until the task is queued to fire the <code id=ongoing-navigation-tracking:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event
     <td>So that we can use it to fire the <code id=ongoing-navigation-tracking:event-navigate-2><a href=indices.html#event-navigate>navigate</a></code> after the trip through the <a href=document-sequences.html#tn-session-history-traversal-queue id=ongoing-navigation-tracking:tn-session-history-traversal-queue>session history traversal queue</a>.
    <tr><td>Any <code id=ongoing-navigation-tracking:dom-navigationresult-committed-2><a href=#dom-navigationresult-committed>committed</a></code> promise that was returned
     <td>Until the session history is updated (inside that same task)
     <td>So that we can resolve or reject it appropriately
    <tr><td>Whether <code id=ongoing-navigation-tracking:dom-navigateevent-intercept-5><a href=#dom-navigateevent-intercept>intercept()</a></code> was called
     <td>Until the session history is updated (inside that same task)
     <td>So that we can suppress the normal scroll restoration logic in favor of the behavior given by the <code id=ongoing-navigation-tracking:dom-navigationinterceptoptions-scroll><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code> option
  </table>

  <p>We also cannot assume there is only a single navigation requested at any given time, due to web
  developer code such as:</p>

  <pre><code class='js'><c- a>const</c-> p1 <c- o>=</c-> navigation<c- p>.</c->navigate<c- p>(</c->url1<c- p>).</c->finished<c- p>;</c->
<c- a>const</c-> p2 <c- o>=</c-> navigation<c- p>.</c->navigate<c- p>(</c->url2<c- p>).</c->finished<c- p>;</c-></code></pre>

  <p>That is, in this scenario, we need to ensure that while navigating to <code>url2</code>, we still have the promise <code>p1</code> around so that we can
  reject it. We can't just get rid of any ongoing navigation promises the moment the second call to
  <code id=ongoing-navigation-tracking:dom-navigation-navigate><a href=#dom-navigation-navigate>navigate()</a></code> happens.</p>

  <p>We end up accomplishing all this by associating the following with each
  <code id=ongoing-navigation-tracking:navigation-2><a href=#navigation>Navigation</a></code>:</p>

  <ul><li><p><dfn id=ongoing-navigate-event>Ongoing <code>navigate</code> event</dfn>, a
   <code id=ongoing-navigation-tracking:navigateevent-2><a href=#navigateevent>NavigateEvent</a></code> or null, initially null.<li><p><dfn id=focus-changed-during-ongoing-navigation>Focus changed during ongoing navigation</dfn>, a boolean, initially false.<li><p><dfn id=suppress-normal-scroll-restoration-during-ongoing-navigation>Suppress normal scroll restoration during ongoing navigation</dfn>, a boolean,
   initially false.<li><p><dfn id=ongoing-api-method-tracker>Ongoing API method tracker</dfn>, a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker>navigation API method tracker</a> or
   null, initially null.<li><p><dfn id=upcoming-non-traverse-api-method-tracker>Upcoming non-traverse API method tracker</dfn>, a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-2>navigation API method
   tracker</a> or null, initially null.<li><p><dfn id=upcoming-traverse-api-method-trackers>Upcoming traverse API method trackers</dfn>, an <a id=ongoing-navigation-tracking:ordered-map href=https://infra.spec.whatwg.org/#ordered-map data-x-internal=ordered-map>ordered map</a> from strings
   to <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-3>navigation API method trackers</a>, initially
   empty.</ul>

  <p class=note>The state here that is not stored in <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-4>navigation API method trackers</a> is state which needs to be tracked even for
  navigations that are not initiated via navigation API methods.</p>

  <p>A <dfn id=navigation-api-method-tracker>navigation API method tracker</dfn> is a <a id=ongoing-navigation-tracking:struct href=https://infra.spec.whatwg.org/#struct data-x-internal=struct>struct</a> with the following <a href=https://infra.spec.whatwg.org/#struct-item id=ongoing-navigation-tracking:struct-item data-x-internal=struct-item>items</a>:</p>

  <ul><li><p>A <dfn id=navigation-api-method-tracker-navigation>navigation object</dfn>, a
   <code id=ongoing-navigation-tracking:navigation-3><a href=#navigation>Navigation</a></code><li><p>A <dfn id=navigation-api-method-tracker-key>key</dfn>, a string or null<li><p>An <dfn id=navigation-api-method-tracker-info>info</dfn>, a JavaScript
   value<li><p>A <dfn id=navigation-api-method-tracker-state>serialized state</dfn>, a
   <a id=ongoing-navigation-tracking:serialized-state href=browsing-the-web.html#serialized-state>serialized state</a> or null<li><p>A <dfn id=navigation-api-method-tracker-committed-to-entry>committed-to entry</dfn>,
   a <code id=ongoing-navigation-tracking:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> or null<li><p>A <dfn id=navigation-api-method-tracker-committed>committed promise</dfn>, a
   promise<li><p>A <dfn id=navigation-api-method-tracker-finished>finished promise</dfn>, a
   promise</ul>

  <p>All this state is then managed via the following algorithms.</p>

  <p>To <dfn id=maybe-set-the-upcoming-non-traverse-api-method-tracker>maybe set the upcoming non-traverse API method tracker</dfn> given a
  <code id=ongoing-navigation-tracking:navigation-4><a href=#navigation>Navigation</a></code> <var>navigation</var>, a JavaScript value <var>info</var>, and a
  <a id=ongoing-navigation-tracking:serialized-state-2 href=browsing-the-web.html#serialized-state>serialized state</a>-or-null <var>serializedState</var>:</p>

  <ol><li><p>Let <var>committedPromise</var> and <var>finishedPromise</var> be new promises created in
   <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=ongoing-navigation-tracking:concept-relevant-realm>relevant realm</a>.<li>
    <p><a id=ongoing-navigation-tracking:mark-as-handled href=https://webidl.spec.whatwg.org/#mark-a-promise-as-handled data-x-internal=mark-as-handled>Mark as handled</a> <var>finishedPromise</var>.</p>

    <div id=note-mark-as-handled-navigation-api-finished class=note><a href=#note-mark-as-handled-navigation-api-finished class=self-link></a>
     <p>The web developer doesn’t necessarily care about <var>finishedPromise</var> being
     rejected:</p>

     <ul><li><p>They might only care about <var>committedPromise</var>.<li><p>They could be doing multiple synchronous navigations within the same task, in which
      case all but the last will be aborted (causing their <var>finishedPromise</var> to reject).
      This could be an application bug, but also could just be an emergent feature of disparate
      parts of the application overriding each others' actions.<li><p>They might prefer to listen to other transition-failure signals instead of
      <var>finishedPromise</var>, e.g., the <code id=ongoing-navigation-tracking:event-navigateerror><a href=indices.html#event-navigateerror>navigateerror</a></code>
      event, or the <code id=ongoing-navigation-tracking:dom-navigationtransition-finished><a href=#dom-navigationtransition-finished>navigation.transition.finished</a></code>
      promise.</ul>

     <p>As such, we mark it as handled to ensure that it never triggers <code id=ongoing-navigation-tracking:event-unhandledrejection><a href=indices.html#event-unhandledrejection>unhandledrejection</a></code> events.</p>
    </div>
   <li>
    <p>Let <var>apiMethodTracker</var> be a new <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-5>navigation API method tracker</a> with:</p>

    <dl class=props><dt><a href=#navigation-api-method-tracker-navigation id=ongoing-navigation-tracking:navigation-api-method-tracker-navigation>navigation object</a><dd><var>navigation</var><dt><a href=#navigation-api-method-tracker-key id=ongoing-navigation-tracking:navigation-api-method-tracker-key>key</a><dd>null<dt><a href=#navigation-api-method-tracker-info id=ongoing-navigation-tracking:navigation-api-method-tracker-info>info</a><dd><var>info</var><dt><a href=#navigation-api-method-tracker-state id=ongoing-navigation-tracking:navigation-api-method-tracker-state>serialized state</a><dd><var>serializedState</var><dt><a href=#navigation-api-method-tracker-committed-to-entry id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-to-entry>committed-to entry</a><dd>null<dt><a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed>committed promise</a><dd><var>committedPromise</var><dt><a href=#navigation-api-method-tracker-finished id=ongoing-navigation-tracking:navigation-api-method-tracker-finished>finished promise</a><dd><var>finishedPromise</var></dl>
   <li><p><a id=ongoing-navigation-tracking:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=ongoing-navigation-tracking:upcoming-non-traverse-api-method-tracker>upcoming non-traverse API method
   tracker</a> is null.<li id=dont-always-set-upcoming-non-traverse-api-method-tracker>
    <p>If <var>navigation</var> does not <a href=#has-entries-and-events-disabled id=ongoing-navigation-tracking:has-entries-and-events-disabled>have
    entries and events disabled</a>, then set <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=ongoing-navigation-tracking:upcoming-non-traverse-api-method-tracker-2>upcoming
    non-traverse API method tracker</a> to <var>apiMethodTracker</var>.</p>

    <p class=note>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=ongoing-navigation-tracking:has-entries-and-events-disabled-2>has entries and events disabled</a>, then
    <var>committedPromise</var> and <var>finishedPromise</var> will never fulfill (since we never
    create a <code id=ongoing-navigation-tracking:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> object for such <code id=ongoing-navigation-tracking:document><a href=dom.html#document>Document</a></code>s, and so we
    have nothing to resolve them with); there is no <code id=ongoing-navigation-tracking:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> to apply
    <var>serializedState</var> to; and there is no <code id=ongoing-navigation-tracking:event-navigate-3><a href=indices.html#event-navigate>navigate</a></code>
    event to include <var>info</var> with. So, we don't need to track this API method call after
    all.</p>
   <li><p>Return <var>apiMethodTracker</var>.</ol>

  <p>To <dfn id=add-an-upcoming-traverse-api-method-tracker>add an upcoming traverse API method tracker</dfn> given a <code id=ongoing-navigation-tracking:navigation-5><a href=#navigation>Navigation</a></code>
  <var>navigation</var>, a string <var>destinationKey</var>, and a JavaScript value
  <var>info</var>:</p>

  <ol><li><p>Let <var>committedPromise</var> and <var>finishedPromise</var> be new promises created in
   <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=ongoing-navigation-tracking:concept-relevant-realm-2>relevant realm</a>.<li>
    <p><a id=ongoing-navigation-tracking:mark-as-handled-2 href=https://webidl.spec.whatwg.org/#mark-a-promise-as-handled data-x-internal=mark-as-handled>Mark as handled</a> <var>finishedPromise</var>.</p>

    <p class=note>See the <a href=#note-mark-as-handled-navigation-api-finished>previous
    discussion</a> about why this is done.</p>
   <li>
    <p>Let <var>apiMethodTracker</var> be a new <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-6>navigation API method tracker</a> with:</p>

    <dl class=props><dt><a href=#navigation-api-method-tracker-navigation id=ongoing-navigation-tracking:navigation-api-method-tracker-navigation-2>navigation object</a><dd><var>navigation</var><dt><a href=#navigation-api-method-tracker-key id=ongoing-navigation-tracking:navigation-api-method-tracker-key-2>key</a><dd><var>destinationKey</var><dt><a href=#navigation-api-method-tracker-info id=ongoing-navigation-tracking:navigation-api-method-tracker-info-2>info</a><dd><var>info</var><dt><a href=#navigation-api-method-tracker-state id=ongoing-navigation-tracking:navigation-api-method-tracker-state-2>serialized state</a><dd>null<dt><a href=#navigation-api-method-tracker-committed-to-entry id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-to-entry-2>committed-to entry</a><dd>null<dt><a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-2>committed promise</a><dd><var>committedPromise</var><dt><a href=#navigation-api-method-tracker-finished id=ongoing-navigation-tracking:navigation-api-method-tracker-finished-2>finished promise</a><dd><var>finishedPromise</var></dl>
   <li><p>Set <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers>upcoming traverse API method
   trackers</a>[<var>destinationKey</var>] to <var>apiMethodTracker</var>.<li><p>Return <var>apiMethodTracker</var>.</ol>

  <p>To <dfn id=promote-an-upcoming-api-method-tracker-to-ongoing>promote an upcoming API method tracker to ongoing</dfn> given a <code id=ongoing-navigation-tracking:navigation-6><a href=#navigation>Navigation</a></code>
  <var>navigation</var> and a string-or-null <var>destinationKey</var>:</p>

  <ol><li><p><a id=ongoing-navigation-tracking:assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker>ongoing API method tracker</a> is
   null.<li>
    <p>If <var>destinationKey</var> is not null, then:</p>

    <ol><li><p><a id=ongoing-navigation-tracking:assert-3 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=ongoing-navigation-tracking:upcoming-non-traverse-api-method-tracker-3>upcoming non-traverse API method
     tracker</a> is null.<li>
      <p>If <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-2>upcoming traverse API method
      trackers</a>[<var>destinationKey</var>] <a href=https://infra.spec.whatwg.org/#map-exists id=ongoing-navigation-tracking:map-exists data-x-internal=map-exists>exists</a>, then:</p>

      <ol><li><p>Set <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker-2>ongoing API method tracker</a> to
       <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-3>upcoming traverse API method
       trackers</a>[<var>destinationKey</var>].<li><p><a href=https://infra.spec.whatwg.org/#map-remove id=ongoing-navigation-tracking:map-remove data-x-internal=map-remove>Remove</a> <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-4>upcoming
       traverse API method trackers</a>[<var>destinationKey</var>].</ol>
     </ol>
   <li>
    <p>Otherwise:</p>

    <ol><li><p>Set <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker-3>ongoing API method tracker</a> to
     <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=ongoing-navigation-tracking:upcoming-non-traverse-api-method-tracker-4>upcoming non-traverse API method tracker</a>.<li><p>Set <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=ongoing-navigation-tracking:upcoming-non-traverse-api-method-tracker-5>upcoming non-traverse API method tracker</a> to
     null.</ol>
   </ol>

  <p>To <dfn id=navigation-api-method-tracker-clean-up>clean up</dfn> a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-7>navigation API
  method tracker</a> <var>apiMethodTracker</var>:</p>

  <ol><li><p>Let <var>navigation</var> be <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-navigation id=ongoing-navigation-tracking:navigation-api-method-tracker-navigation-3>navigation object</a>.<li><p>If <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker-4>ongoing API method tracker</a> is
   <var>apiMethodTracker</var>, then set <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker-5>ongoing API method
   tracker</a> to null.<li>
    <p>Otherwise:</p>

    <ol><li><p>Let <var>key</var> be <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-key id=ongoing-navigation-tracking:navigation-api-method-tracker-key-3>key</a>.<li><p><a id=ongoing-navigation-tracking:assert-4 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>key</var> is not null.<li><p><a id=ongoing-navigation-tracking:assert-5 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-5>upcoming traverse API method
     trackers</a>[<var>key</var>] <a href=https://infra.spec.whatwg.org/#map-exists id=ongoing-navigation-tracking:map-exists-2 data-x-internal=map-exists>exists</a>.<li><p><a href=https://infra.spec.whatwg.org/#map-remove id=ongoing-navigation-tracking:map-remove-2 data-x-internal=map-remove>Remove</a> <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-6>upcoming traverse
     API method trackers</a>[<var>key</var>].</ol>
   </ol>

  <p>To <dfn id=notify-about-the-committed-to-entry>notify about the committed-to entry</dfn> given a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-8>navigation API method
  tracker</a> <var>apiMethodTracker</var> and a <code id=ongoing-navigation-tracking:navigationhistoryentry-5><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>
  <var>nhe</var>:</p>

  <ol><li><p>Set <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed-to-entry id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-to-entry-3>committed-to entry</a> to
   <var>nhe</var>.<li>
    <p>If <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-state id=ongoing-navigation-tracking:navigation-api-method-tracker-state-3>serialized state</a> is not null, then set
    <var>nhe</var>'s <a href=#nhe-she id=ongoing-navigation-tracking:nhe-she>session history entry</a>'s <a href=browsing-the-web.html#she-navigation-api-state id=ongoing-navigation-tracking:she-navigation-api-state-2>navigation API state</a> to <var>apiMethodTracker</var>'s
    <a href=#navigation-api-method-tracker-state id=ongoing-navigation-tracking:navigation-api-method-tracker-state-4>serialized state</a>.</p>

    <p class=note>If it's null, then we're traversing to <var>nhe</var> via <code id=ongoing-navigation-tracking:dom-navigation-traverseto><a href=#dom-navigation-traverseto>navigation.traverseTo()</a></code>, which does not allow changing
    the state.</p>

    <p class=note>At this point, <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-state id=ongoing-navigation-tracking:navigation-api-method-tracker-state-5>serialized state</a> is no longer needed.
    Implementations might want to clear it out to avoid keeping it alive for the lifetime of the
    <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-9>navigation API method tracker</a>.</p>
   <li>
    <p>Resolve <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-3>committed promise</a> with
    <var>nhe</var>.</p>

    <p class=note>At this point, <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-4>committed promise</a> is only needed in
    cases where it has not yet been returned to author code. Implementations might want to clear it
    out to avoid keeping it alive for the lifetime of the <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-10>navigation API method
    tracker</a>.</p>
   </ol>

  <p>To <dfn id=resolve-the-finished-promise>resolve the finished promise</dfn> for a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-11>navigation API method tracker</a>
  <var>apiMethodTracker</var>:</p>

  <ol><li><p><a id=ongoing-navigation-tracking:assert-6 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed-to-entry id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-to-entry-4>committed-to entry</a> is not
   null.<li><p>Resolve <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-finished id=ongoing-navigation-tracking:navigation-api-method-tracker-finished-3>finished promise</a> with its <a href=#navigation-api-method-tracker-committed-to-entry id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-to-entry-5>committed-to entry</a>.<li><p><a href=#navigation-api-method-tracker-clean-up id=ongoing-navigation-tracking:navigation-api-method-tracker-clean-up>Clean up</a>
   <var>apiMethodTracker</var>.</ol>

  <p>To <dfn id=reject-the-finished-promise>reject the finished promise</dfn> for a <a href=#navigation-api-method-tracker id=ongoing-navigation-tracking:navigation-api-method-tracker-12>navigation API method tracker</a>
  <var>apiMethodTracker</var> with a JavaScript value <var>exception</var>:</p>

  <ol><li>
    <p>Reject <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-5>committed promise</a> with
    <var>exception</var>.</p>

    <p class=note>This will do nothing if <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-committed id=ongoing-navigation-tracking:navigation-api-method-tracker-committed-6>committed promise</a> was previously
    resolved via <a href=#notify-about-the-committed-to-entry id=ongoing-navigation-tracking:notify-about-the-committed-to-entry>notify about the committed-to entry</a>.</p>
   <li><p>Reject <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-finished id=ongoing-navigation-tracking:navigation-api-method-tracker-finished-4>finished promise</a> with
   <var>exception</var>.<li><p><a href=#navigation-api-method-tracker-clean-up id=ongoing-navigation-tracking:navigation-api-method-tracker-clean-up-2>Clean up</a>
   <var>apiMethodTracker</var>.</ol>

  <p>To <dfn id=abort-the-ongoing-navigation>abort the ongoing navigation</dfn> given a <code id=ongoing-navigation-tracking:navigation-7><a href=#navigation>Navigation</a></code>
  <var>navigation</var> and an optional <code id=ongoing-navigation-tracking:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> <var>error</var>:</p>

  <ol><li><p>Let <var>event</var> be <var>navigation</var>'s <a href=#ongoing-navigate-event id=ongoing-navigation-tracking:ongoing-navigate-event>ongoing <code>navigate</code> event</a>.<li><p><a id=ongoing-navigation-tracking:assert-7 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var> is not null.<li><p>Set <var>navigation</var>'s <a href=#focus-changed-during-ongoing-navigation id=ongoing-navigation-tracking:focus-changed-during-ongoing-navigation>focus changed during ongoing navigation</a> to
   false.<li><p>Set <var>navigation</var>'s <a href=#suppress-normal-scroll-restoration-during-ongoing-navigation id=ongoing-navigation-tracking:suppress-normal-scroll-restoration-during-ongoing-navigation>suppress normal scroll restoration during ongoing
   navigation</a> to false.<li><p>If <var>error</var> was not given, then let <var>error</var> be a new
   <a id=ongoing-navigation-tracking:aborterror href=https://webidl.spec.whatwg.org/#aborterror data-x-internal=aborterror>"<code>AbortError</code>"</a> <code id=ongoing-navigation-tracking:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> created in
   <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=ongoing-navigation-tracking:concept-relevant-realm-3>relevant realm</a>.<li><p>If <var>event</var>'s <a id=ongoing-navigation-tracking:dispatch-flag href=https://dom.spec.whatwg.org/#dispatch-flag data-x-internal=dispatch-flag>dispatch flag</a> is set, then set <var>event</var>'s
   <a id=ongoing-navigation-tracking:canceled-flag-3 href=https://dom.spec.whatwg.org/#canceled-flag data-x-internal=canceled-flag>canceled flag</a> to true.<li><p><a href=#abort-a-navigateevent id=ongoing-navigation-tracking:abort-a-navigateevent>Abort</a> <var>event</var>.</ol>

  <p>To <dfn id=abort-a-navigateevent>abort a <code>NavigateEvent</code></dfn> <var>event</var> given <var>reason</var>:</p>

  <ol><li><p>Let <var>navigation</var> be <var>event</var>'s <a id=ongoing-navigation-tracking:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#window-navigation-api id=ongoing-navigation-tracking:window-navigation-api>navigation API</a>.<li><p><a id=ongoing-navigation-tracking:signal-abort-2 href=https://dom.spec.whatwg.org/#abortcontroller-signal-abort data-x-internal=signal-abort>Signal abort</a> on <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=ongoing-navigation-tracking:concept-navigateevent-abort-controller-2>abort controller</a> given
   <var>reason</var>.<li>
    <p>Let <var>errorInfo</var> be the result of <a href=webappapis.html#extract-error id=ongoing-navigation-tracking:extract-error>extracting error
    information</a> from <var>reason</var>.</p>

    <p class=note>For example, if this algorithm is reached because of a call to <code id=ongoing-navigation-tracking:dom-window-stop><a href=#dom-window-stop>window.stop()</a></code>, these properties would probably end up
    initialized based on the line of script that called <code id=ongoing-navigation-tracking:dom-window-stop-2><a href=#dom-window-stop>window.stop()</a></code>. But if it's because the user clicked the stop
    button, these properties would probably end up with default values like the empty string or
    0.</p>
   <li><p>Set <var>navigation</var>'s <a href=#ongoing-navigate-event id=ongoing-navigation-tracking:ongoing-navigate-event-2>ongoing <code>navigate</code>
   event</a> to null.<li><p>If <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=ongoing-navigation-tracking:ongoing-api-method-tracker-6>ongoing API method tracker</a> is non-null, then
   <a href=#reject-the-finished-promise id=ongoing-navigation-tracking:reject-the-finished-promise>reject the finished promise</a> for <var>apiMethodTracker</var> with
   <var>error</var>.<li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=ongoing-navigation-tracking:concept-event-fire data-x-internal=concept-event-fire>Fire an event</a> named <code id=ongoing-navigation-tracking:event-navigateerror-2><a href=indices.html#event-navigateerror>navigateerror</a></code> at <var>navigation</var> using
   <code id=ongoing-navigation-tracking:errorevent><a href=webappapis.html#errorevent>ErrorEvent</a></code>, with additional attributes initialized according to
   <var>errorInfo</var>.<li><p>If <var>navigation</var>'s <a href=#concept-navigation-transition id=ongoing-navigation-tracking:concept-navigation-transition>transition</a>
   is null, then return.<li><p>Reject <var>navigation</var>'s <a href=#concept-navigation-transition id=ongoing-navigation-tracking:concept-navigation-transition-2>transition</a>'s <a href=#concept-navigationtransition-committed id=ongoing-navigation-tracking:concept-navigationtransition-committed>committed promise</a> with
   <var>error</var>.<li><p>Reject <var>navigation</var>'s <a href=#concept-navigation-transition id=ongoing-navigation-tracking:concept-navigation-transition-3>transition</a>'s <a href=#concept-navigationtransition-finished id=ongoing-navigation-tracking:concept-navigationtransition-finished>finished promise</a> with
   <var>error</var>.<li><p>Set <var>navigation</var>'s <a href=#concept-navigation-transition id=ongoing-navigation-tracking:concept-navigation-transition-4>transition</a>
   to null.</ol>

  <p>To <dfn id=inform-the-navigation-api-about-aborting-navigation>inform the navigation API about aborting navigation</dfn> in a <a id=ongoing-navigation-tracking:navigable href=document-sequences.html#navigable>navigable</a>
  <var>navigable</var>:</p>

  <ol><li><p>If this algorithm is running on <var>navigable</var>'s <a href=document-sequences.html#nav-window id=ongoing-navigation-tracking:nav-window>active
   window</a>'s <a id=ongoing-navigation-tracking:relevant-agent href=webappapis.html#relevant-agent>relevant agent</a>'s <a href=webappapis.html#concept-agent-event-loop id=ongoing-navigation-tracking:concept-agent-event-loop>event
   loop</a>, then continue on to the following steps. Otherwise, <a id=ongoing-navigation-tracking:queue-a-global-task href=webappapis.html#queue-a-global-task>queue a global task</a>
   on the <a id=ongoing-navigation-tracking:navigation-and-traversal-task-source href=webappapis.html#navigation-and-traversal-task-source>navigation and traversal task source</a> given <var>navigable</var>'s <a href=document-sequences.html#nav-window id=ongoing-navigation-tracking:nav-window-2>active window</a> to run the following steps.<li><p>Let <var>navigation</var> be <var>navigable</var>'s <a href=document-sequences.html#nav-window id=ongoing-navigation-tracking:nav-window-3>active
   window</a>'s <a href=#window-navigation-api id=ongoing-navigation-tracking:window-navigation-api-2>navigation API</a>.<li><p>If <var>navigation</var>'s <a href=#ongoing-navigate-event id=ongoing-navigation-tracking:ongoing-navigate-event-3>ongoing <code>navigate</code>
   event</a> is null, then return.<li><p><a href=#abort-the-ongoing-navigation id=ongoing-navigation-tracking:abort-the-ongoing-navigation>Abort the ongoing navigation</a> given <var>navigation</var>.</ol>

  <p>To <dfn id=inform-the-navigation-api-about-child-navigable-destruction>inform the navigation API about child navigable destruction</dfn> given a
  <a id=ongoing-navigation-tracking:navigable-2 href=document-sequences.html#navigable>navigable</a> <var>navigable</var>:</p>

  <ol><li><p><a href=#inform-the-navigation-api-about-aborting-navigation id=ongoing-navigation-tracking:inform-the-navigation-api-about-aborting-navigation>Inform the navigation API about aborting navigation</a> in
   <var>navigable</var>.<li><p>Let <var>navigation</var> be <var>navigable</var>'s <a href=document-sequences.html#nav-window id=ongoing-navigation-tracking:nav-window-4>active
   window</a>'s <a href=#window-navigation-api id=ongoing-navigation-tracking:window-navigation-api-3>navigation API</a>.<li><p>Let <var>traversalAPIMethodTrackers</var> be a <a href=https://infra.spec.whatwg.org/#list-clone id=ongoing-navigation-tracking:list-clone data-x-internal=list-clone>clone</a> of
   <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=ongoing-navigation-tracking:upcoming-traverse-api-method-trackers-7>upcoming traverse API method trackers</a>.<li><p><a href=https://infra.spec.whatwg.org/#list-iterate id=ongoing-navigation-tracking:list-iterate data-x-internal=list-iterate>For each</a> <var>apiMethodTracker</var> of
   <var>traversalAPIMethodTrackers</var>: <a href=#reject-the-finished-promise id=ongoing-navigation-tracking:reject-the-finished-promise-2>reject the finished promise</a> for
   <var>apiMethodTracker</var> with a new <a id=ongoing-navigation-tracking:aborterror-2 href=https://webidl.spec.whatwg.org/#aborterror data-x-internal=aborterror>"<code>AbortError</code>"</a>
   <code id=ongoing-navigation-tracking:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=ongoing-navigation-tracking:concept-relevant-realm-4>relevant realm</a>.</ol>

  <hr>

  <p>The ongoing navigation concept is most-directly exposed to web developers through the <code id=ongoing-navigation-tracking:dom-navigation-transition><a href=#dom-navigation-transition>navigation.transition</a></code> property, which is an instance of
  the <code id=ongoing-navigation-tracking:navigationtransition><a href=#navigationtransition>NavigationTransition</a></code> interface:</p>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigationtransition' data-dfn-type='interface'><c- g>NavigationTransition</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationtype' id='ongoing-navigation-tracking:navigationtype-2'><c- n>NavigationType</c-></a> <a href='#dom-navigationtransition-navigationtype' id='ongoing-navigation-tracking:dom-navigationtransition-navigationtype'><c- g>navigationType</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationhistoryentry' id='ongoing-navigation-tracking:navigationhistoryentry-6'><c- n>NavigationHistoryEntry</c-></a> <a href='#dom-navigationtransition-from' id='ongoing-navigation-tracking:dom-navigationtransition-from'><c- g>from</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='https://webidl.spec.whatwg.org/#idl-promise' id='ongoing-navigation-tracking:idl-promise' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<c- b>undefined</c->&gt; <a href='#dom-navigationtransition-committed' id='ongoing-navigation-tracking:dom-navigationtransition-committed'><c- g>committed</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='https://webidl.spec.whatwg.org/#idl-promise' id='ongoing-navigation-tracking:idl-promise-2' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<c- b>undefined</c->&gt; <a href='#dom-navigationtransition-finished' id='ongoing-navigation-tracking:dom-navigationtransition-finished-2'><c- g>finished</c-></a>;
};</code></pre>

  

  <dl class=domintro><dt><code><a href=#dom-navigation id=ongoing-navigation-tracking:dom-navigation>navigation</a>.<a href=#dom-navigation-transition id=dom-navigation-transition-dev>transition</a></code><dd>
    <p>A <code id=ongoing-navigation-tracking:navigationtransition-2><a href=#navigationtransition>NavigationTransition</a></code> representing any ongoing navigation that hasn't yet
    reached the <code id=ongoing-navigation-tracking:event-navigatesuccess><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code> or <code id=ongoing-navigation-tracking:event-navigateerror-3><a href=indices.html#event-navigateerror>navigateerror</a></code> stage, if one exists; or null, if there is no
    such transition ongoing.</p>

    <p>Since <code id=ongoing-navigation-tracking:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> (and other
    properties like <code id=ongoing-navigation-tracking:dom-location-href><a href=#dom-location-href>location.href</a></code>) are updated immediately
    upon navigation, this <code id=ongoing-navigation-tracking:dom-navigation-transition-2><a href=#dom-navigation-transition>navigation.transition</a></code>
    property is useful for determining when such navigations are not yet fully settled, according to
    any handlers passed to <code id=ongoing-navigation-tracking:dom-navigateevent-intercept-6><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code>.</p>
   <dt><code><a href=#dom-navigation id=ongoing-navigation-tracking:dom-navigation-2>navigation</a>.<a href=#dom-navigation-transition id=ongoing-navigation-tracking:dom-navigation-transition-3>transition</a>.<a href=#dom-navigationtransition-navigationtype id=dom-navigationtransition-navigationtype-dev>navigationType</a></code><dd><p>One of "<code id=ongoing-navigation-tracking:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>", "<code id=ongoing-navigation-tracking:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>", "<code id=ongoing-navigation-tracking:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", or "<code id=ongoing-navigation-tracking:dom-navigationtype-traverse-3><a href=#dom-navigationtype-traverse>traverse</a></code>", indicating what type of navigation this
   transition is for.<dt><code><a href=#dom-navigation id=ongoing-navigation-tracking:dom-navigation-3>navigation</a>.<a href=#dom-navigation-transition id=ongoing-navigation-tracking:dom-navigation-transition-4>transition</a>.<a href=#dom-navigationtransition-from id=dom-navigationtransition-from-dev>from</a></code><dd><p>The <code id=ongoing-navigation-tracking:navigationhistoryentry-7><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> from which the transition is coming. This can be
   useful to compare against <code id=ongoing-navigation-tracking:dom-navigation-currententry-2><a href=#dom-navigation-currententry>navigation.currentEntry</a></code>.<dt><code><a href=#dom-navigation id=ongoing-navigation-tracking:dom-navigation-4>navigation</a>.<a href=#dom-navigation-transition id=ongoing-navigation-tracking:dom-navigation-transition-5>transition</a>.<a href=#dom-navigationtransition-committed id=dom-navigationtransition-committed-dev>committed</a></code><dd><p>A promise which fulfills once the <code id=ongoing-navigation-tracking:dom-navigation-currententry-3><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> and <a href=https://dom.spec.whatwg.org/#concept-document-url id="ongoing-navigation-tracking:the-document's-address" data-x-internal="the-document's-address">URL</a> change. This occurs after all of its <a href=#dom-navigationinterceptoptions-precommithandler id=ongoing-navigation-tracking:dom-navigationinterceptoptions-precommithandler>precommit handlers</a> are fulfilled.
   The promise rejects if one or more of the <a href=#dom-navigationinterceptoptions-precommithandler id=ongoing-navigation-tracking:dom-navigationinterceptoptions-precommithandler-2>precommit handlers</a>
   rejects.<dt><code><a href=#dom-navigation id=ongoing-navigation-tracking:dom-navigation-5>navigation</a>.<a href=#dom-navigation-transition id=ongoing-navigation-tracking:dom-navigation-transition-6>transition</a>.<a href=#dom-navigationtransition-finished id=dom-navigationtransition-finished-dev>finished</a></code><dd><p>A promise which fulfills at the same time as the <code id=ongoing-navigation-tracking:event-navigatesuccess-2><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code> fires, or rejects at the same time the
   <code id=ongoing-navigation-tracking:event-navigateerror-4><a href=indices.html#event-navigateerror>navigateerror</a></code> event fires.</dl>

  

  <p>Each <code id=ongoing-navigation-tracking:navigation-8><a href=#navigation>Navigation</a></code> has a <dfn id=concept-navigation-transition>transition</dfn>, which is a
  <code id=ongoing-navigation-tracking:navigationtransition-3><a href=#navigationtransition>NavigationTransition</a></code> or null, initially null.</p>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-transition data-dfn-type=attribute><code>transition</code></dfn> getter steps are to return
  <a id=ongoing-navigation-tracking:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigation-transition id=ongoing-navigation-tracking:concept-navigation-transition-5>transition</a>.</p>

  <p>Each <code id=ongoing-navigation-tracking:navigationtransition-4><a href=#navigationtransition>NavigationTransition</a></code> has an associated <dfn id=concept-navigationtransition-navigationtype>navigation type</dfn>, which is a
  <code id=ongoing-navigation-tracking:navigationtype-3><a href=#navigationtype>NavigationType</a></code>.</p>

  <p>Each <code id=ongoing-navigation-tracking:navigationtransition-5><a href=#navigationtransition>NavigationTransition</a></code> has an associated <dfn id=concept-navigationtransition-from>from entry</dfn>, which is a
  <code id=ongoing-navigation-tracking:navigationhistoryentry-8><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>.</p>

  <p>Each <code id=ongoing-navigation-tracking:navigationtransition-6><a href=#navigationtransition>NavigationTransition</a></code> has an associated <dfn id=concept-navigationtransition-committed>committed promise</dfn>, which is a promise.</p>

  <p>Each <code id=ongoing-navigation-tracking:navigationtransition-7><a href=#navigationtransition>NavigationTransition</a></code> has an associated <dfn id=concept-navigationtransition-finished>finished promise</dfn>, which is a promise.</p>

  <p>The <dfn data-dfn-for=NavigationTransition id=dom-navigationtransition-navigationtype data-dfn-type=attribute><code>navigationType</code></dfn> getter steps are to
  return <a id=ongoing-navigation-tracking:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationtransition-navigationtype id=ongoing-navigation-tracking:concept-navigationtransition-navigationtype>navigation
  type</a>.</p>

  <p>The <dfn data-dfn-for=NavigationTransition id=dom-navigationtransition-from data-dfn-type=attribute><code>from</code></dfn> getter steps are to return
  <a id=ongoing-navigation-tracking:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationtransition-from id=ongoing-navigation-tracking:concept-navigationtransition-from>from entry</a>.</p>

  <p>The <dfn data-dfn-for=NavigationTransition id=dom-navigationtransition-committed data-dfn-type=attribute><code>committed</code></dfn> getter steps are to return
  <a id=ongoing-navigation-tracking:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationtransition-committed id=ongoing-navigation-tracking:concept-navigationtransition-committed-2>committed
  promise</a>.</p>

  <p>The <dfn data-dfn-for=NavigationTransition id=dom-navigationtransition-finished data-dfn-type=attribute><code>finished</code></dfn> getter steps are to return
  <a id=ongoing-navigation-tracking:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationtransition-finished id=ongoing-navigation-tracking:concept-navigationtransition-finished-2>finished
  promise</a>.</p>

  


  <h5 id=navigation-activation-interface><span class=secno>7.2.6.9</span> The <code id=navigation-activation-interface:navigationactivation><a href=#navigationactivation>NavigationActivation</a></code> interface<a href=#navigation-activation-interface class=self-link></a></h5>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigationactivation' data-dfn-type='interface'><c- g>NavigationActivation</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationhistoryentry' id='navigation-activation-interface:navigationhistoryentry'><c- n>NavigationHistoryEntry</c-></a>? <a href='#dom-navigationactivation-from' id='navigation-activation-interface:dom-navigationactivation-from'><c- g>from</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationhistoryentry' id='navigation-activation-interface:navigationhistoryentry-2'><c- n>NavigationHistoryEntry</c-></a> <a href='#dom-navigationactivation-entry' id='navigation-activation-interface:dom-navigationactivation-entry'><c- g>entry</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationtype' id='navigation-activation-interface:navigationtype'><c- n>NavigationType</c-></a> <a href='#dom-navigationactivation-navigationtype' id='navigation-activation-interface:dom-navigationactivation-navigationtype'><c- g>navigationType</c-></a>;
};</code></pre>

  <dl class=domintro><dt><code><a href=#dom-navigation id=navigation-activation-interface:dom-navigation>navigation</a>.<a href=#dom-navigation-activation id=dom-navigation-activation-dev>activation</a></code><dd>
    <p>A <code id=navigation-activation-interface:navigationactivation-2><a href=#navigationactivation>NavigationActivation</a></code> containing information about the most recent
    cross-document navigation, the navigation that "activated" this <code id=navigation-activation-interface:document><a href=dom.html#document>Document</a></code>.</p>

    <p>While <code id=navigation-activation-interface:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> and the
    <code id=navigation-activation-interface:document-2><a href=dom.html#document>Document</a></code>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="navigation-activation-interface:the-document's-address" data-x-internal="the-document's-address">URL</a> can be updated regularly
    due to same-document navigations, <code id=navigation-activation-interface:dom-navigation-activation><a href=#dom-navigation-activation>navigation.activation</a></code> stays constant, and its properties
    are only updated if the <code id=navigation-activation-interface:document-3><a href=dom.html#document>Document</a></code> is <a href=browsing-the-web.html#reactivate-a-document id=navigation-activation-interface:reactivate-a-document>reactivated</a> from history.</p>
   <dt><code><a href=#dom-navigation id=navigation-activation-interface:dom-navigation-2>navigation</a>.<a href=#dom-navigation-activation id=navigation-activation-interface:dom-navigation-activation-2>activation</a>.<a href=#dom-navigationactivation-entry id=dom-navigationactivation-entry-dev>entry</a></code><dd><p>A <code id=navigation-activation-interface:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, equivalent to the value of the <code id=navigation-activation-interface:dom-navigation-currententry-2><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> property at the moment the
   <code id=navigation-activation-interface:document-4><a href=dom.html#document>Document</a></code> was activated.<dt><code><a href=#dom-navigation id=navigation-activation-interface:dom-navigation-3>navigation</a>.<a href=#dom-navigation-activation id=navigation-activation-interface:dom-navigation-activation-3>activation</a>.<a href=#dom-navigationactivation-from id=dom-navigationactivation-from-dev>from</a></code><dd>
    <p>A <code id=navigation-activation-interface:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, representing the <code id=navigation-activation-interface:document-5><a href=dom.html#document>Document</a></code> that was active
    right before the current <code id=navigation-activation-interface:document-6><a href=dom.html#document>Document</a></code>. This will have a value null in case the
    previous <code id=navigation-activation-interface:document-7><a href=dom.html#document>Document</a></code> was not <a id=navigation-activation-interface:same-origin href=browsers.html#same-origin>same origin</a> with this one or if it was the
    <a href=dom.html#is-initial-about:blank id=navigation-activation-interface:is-initial-about:blank>initial <code>about:blank</code></a>
    <code id=navigation-activation-interface:document-8><a href=dom.html#document>Document</a></code>.</p>

    <p>There are some cases in which either the <code id=navigation-activation-interface:dom-navigationactivation-from-2><a href=#dom-navigationactivation-from>from</a></code> or <code id=navigation-activation-interface:dom-navigationactivation-entry-2><a href=#dom-navigationactivation-entry>entry</a></code> <code id=navigation-activation-interface:navigationhistoryentry-5><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> objects
    would not be viable targets for the <code id=navigation-activation-interface:dom-navigation-traverseto><a href=#dom-navigation-traverseto>traverseTo()</a></code>
    method, as they might not be retained in history. For example, the <code id=navigation-activation-interface:document-9><a href=dom.html#document>Document</a></code> can be
    activated using <code id=navigation-activation-interface:dom-location-replace><a href=#dom-location-replace>location.replace()</a></code> or its initial
    entry could be replaced by <code id=navigation-activation-interface:dom-history-replacestate><a href=#dom-history-replacestate>history.replaceState()</a></code>. However, those entries' <code id=navigation-activation-interface:dom-navigationhistoryentry-url><a href=#dom-navigationhistoryentry-url>url</a></code> property and <code id=navigation-activation-interface:dom-navigationhistoryentry-getstate><a href=#dom-navigationhistoryentry-getstate>getState()</a></code> method are still accessible.</p>
   <dt><code><a href=#dom-navigation id=navigation-activation-interface:dom-navigation-4>navigation</a>.<a href=#dom-navigation-activation id=navigation-activation-interface:dom-navigation-activation-4>activation</a>.<a href=#dom-navigationactivation-navigationtype id=dom-navigationactivation-navigationtype-dev>navigationType</a></code><dd><p>One of "<code id=navigation-activation-interface:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>", "<code id=navigation-activation-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>", "<code id=navigation-activation-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", or "<code id=navigation-activation-interface:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>", indicating what type of navigation
   activated this <code id=navigation-activation-interface:document-10><a href=dom.html#document>Document</a></code>.</dl>

  <p>Each <code id=navigation-activation-interface:navigation><a href=#navigation>Navigation</a></code> has an associated <dfn id=navigation-activation>activation</dfn>, which is null or a
  <code id=navigation-activation-interface:navigationactivation-3><a href=#navigationactivation>NavigationActivation</a></code> object, initially null.</p>

  <p>Each <code id=navigation-activation-interface:navigationactivation-4><a href=#navigationactivation>NavigationActivation</a></code> has:</p>

  <ul><li><p><dfn id=nav-activation-old-entry>old entry</dfn>, null or a
   <code id=navigation-activation-interface:navigationhistoryentry-6><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>.<li><p><dfn id=nav-activation-new-entry>new entry</dfn>, null or a
   <code id=navigation-activation-interface:navigationhistoryentry-7><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>.<li><p><dfn id=nav-activation-navigation-type>navigation type</dfn>, a
   <code id=navigation-activation-interface:navigationtype-2><a href=#navigationtype>NavigationType</a></code>.</ul>

  <p>The <dfn data-dfn-for=Navigation id=dom-navigation-activation data-dfn-type=attribute><code>activation</code></dfn> getter steps are to return
  <a id=navigation-activation-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#navigation-activation id=navigation-activation-interface:navigation-activation>activation</a>.</p>

  <p>The <dfn data-dfn-for=NavigationActivation id=dom-navigationactivation-from data-dfn-type=attribute><code>from</code></dfn> getter steps are to return
  <a id=navigation-activation-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nav-activation-old-entry id=navigation-activation-interface:nav-activation-old-entry>old entry</a>.</p>

  <p>The <dfn data-dfn-for=NavigationActivation id=dom-navigationactivation-entry data-dfn-type=attribute><code>entry</code></dfn> getter steps are to return
  <a id=navigation-activation-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nav-activation-new-entry id=navigation-activation-interface:nav-activation-new-entry>new entry</a>.</p>

  <p>The <dfn data-dfn-for=NavigationActivation id=dom-navigationactivation-navigationtype data-dfn-type=attribute><code>navigationType</code></dfn> getter steps are to
  return <a id=navigation-activation-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#nav-activation-navigation-type id=navigation-activation-interface:nav-activation-navigation-type>navigation type</a>.</p>


  <h5 id=the-navigate-event><span class=secno>7.2.6.10</span> The <code id=the-navigate-event:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event<a href=#the-navigate-event class=self-link></a></h5>

  <p>A major feature of the navigation API is the <code id=the-navigate-event:event-navigate-2><a href=indices.html#event-navigate>navigate</a></code>
  event. This event is fired on any navigation (in the <a href=#navigationtype id=the-navigate-event:navigationtype>broad sense of
  the word</a>), allowing web developers to monitor such outgoing navigations. In many cases, the
  event is <code id=the-navigate-event:dom-event-cancelable><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code>, which allows preventing the
  navigation from happening. And in others, the navigation can be intercepted and replaced with a
  same-document navigation by using the <code id=the-navigate-event:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>intercept()</a></code> method of the <code id=the-navigate-event:navigateevent><a href=#navigateevent>NavigateEvent</a></code>
  class.</p>

  <h6 id=the-navigateevent-interface><span class=secno>7.2.6.10.1</span> The <code id=the-navigateevent-interface:navigateevent><a href=#navigateevent>NavigateEvent</a></code> interface<a href=#the-navigateevent-interface class=self-link></a></h6>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigateevent' data-dfn-type='interface'><c- g>NavigateEvent</c-></dfn> : <a id='the-navigateevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <a href='#navigateeventinit' id='the-navigateevent-interface:navigateeventinit'><c- n>NavigateEventInit</c-></a> <c- g>eventInitDict</c->);

  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationtype' id='the-navigateevent-interface:navigationtype'><c- n>NavigationType</c-></a> <a href='#dom-navigateevent-navigationtype' id='the-navigateevent-interface:dom-navigateevent-navigationtype'><c- g>navigationType</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationdestination' id='the-navigateevent-interface:navigationdestination'><c- n>NavigationDestination</c-></a> <a href='#dom-navigateevent-destination' id='the-navigateevent-interface:dom-navigateevent-destination'><c- g>destination</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigateevent-canintercept' id='the-navigateevent-interface:dom-navigateevent-canintercept'><c- g>canIntercept</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigateevent-userinitiated' id='the-navigateevent-interface:dom-navigateevent-userinitiated'><c- g>userInitiated</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigateevent-hashchange' id='the-navigateevent-interface:dom-navigateevent-hashchange'><c- g>hashChange</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a id='the-navigateevent-interface:abortsignal' href='https://dom.spec.whatwg.org/#abortsignal' data-x-internal='abortsignal'><c- n>AbortSignal</c-></a> <a href='#dom-navigateevent-signal' id='the-navigateevent-interface:dom-navigateevent-signal'><c- g>signal</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <code id='the-navigateevent-interface:formdata'><a data-x-internal='formdata' href='https://xhr.spec.whatwg.org/#formdata'><c- n>FormData</c-></a></code>? <a href='#dom-navigateevent-formdata' id='the-navigateevent-interface:dom-navigateevent-formdata'><c- g>formData</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c->? <a href='#dom-navigateevent-downloadrequest' id='the-navigateevent-interface:dom-navigateevent-downloadrequest'><c- g>downloadRequest</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>any</c-> <a href='#dom-navigateevent-info' id='the-navigateevent-interface:dom-navigateevent-info'><c- g>info</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigateevent-hasuavisualtransition' id='the-navigateevent-interface:dom-navigateevent-hasuavisualtransition'><c- g>hasUAVisualTransition</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- n>Element</c->? <a href='#dom-navigateevent-sourceelement' id='the-navigateevent-interface:dom-navigateevent-sourceelement'><c- g>sourceElement</c-></a>;

  <c- b>undefined</c-> <a href='#dom-navigateevent-intercept' id='the-navigateevent-interface:dom-navigateevent-intercept'><c- g>intercept</c-></a>(<c- b>optional</c-> <a href='#navigationinterceptoptions' id='the-navigateevent-interface:navigationinterceptoptions'><c- n>NavigationInterceptOptions</c-></a> <c- g>options</c-> = {});
  <c- b>undefined</c-> <a href='#dom-navigateevent-scroll' id='the-navigateevent-interface:dom-navigateevent-scroll'><c- g>scroll</c-></a>();
};

<c- b>dictionary</c-> <dfn id='navigateeventinit' data-dfn-type='dictionary'><c- g>NavigateEventInit</c-></dfn> : <a id='the-navigateevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <a href='#navigationtype' id='the-navigateevent-interface:navigationtype-2'><c- n>NavigationType</c-></a> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-navigationtype' data-dfn-type='dict-member'><c- g>navigationType</c-></dfn> = &quot;<a href='#dom-navigationtype-push' id='the-navigateevent-interface:dom-navigationtype-push'>push</a>&quot;;
  <c- b>required</c-> <a href='#navigationdestination' id='the-navigateevent-interface:navigationdestination-2'><c- n>NavigationDestination</c-></a> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-destination' data-dfn-type='dict-member'><c- g>destination</c-></dfn>;
  <c- b>boolean</c-> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-canintercept' data-dfn-type='dict-member'><c- g>canIntercept</c-></dfn> = <c- b>false</c->;
  <c- b>boolean</c-> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-userinitiated' data-dfn-type='dict-member'><c- g>userInitiated</c-></dfn> = <c- b>false</c->;
  <c- b>boolean</c-> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-hashchange' data-dfn-type='dict-member'><c- g>hashChange</c-></dfn> = <c- b>false</c->;
  <c- b>required</c-> <a id='the-navigateevent-interface:abortsignal-2' href='https://dom.spec.whatwg.org/#abortsignal' data-x-internal='abortsignal'><c- n>AbortSignal</c-></a> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-signal' data-dfn-type='dict-member'><c- g>signal</c-></dfn>;
  <a id='the-navigateevent-interface:formdata-2' href='https://xhr.spec.whatwg.org/#formdata' data-x-internal='formdata'><c- n>FormData</c-></a>? <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-formdata' data-dfn-type='dict-member'><c- g>formData</c-></dfn> = <c- b>null</c->;
  <c- b>DOMString</c->? <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-downloadrequest' data-dfn-type='dict-member'><c- g>downloadRequest</c-></dfn> = <c- b>null</c->;
  <c- b>any</c-> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-info' data-dfn-type='dict-member'><c- g>info</c-></dfn>;
  <c- b>boolean</c-> <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-hasuavisualtransition' data-dfn-type='dict-member'><c- g>hasUAVisualTransition</c-></dfn> = <c- b>false</c->;
  <c- n>Element</c->? <dfn data-dfn-for='NavigateEventInit' id='dom-navigateeventinit-sourceelement' data-dfn-type='dict-member'><c- g>sourceElement</c-></dfn> = <c- b>null</c->;
};

<c- b>dictionary</c-> <dfn id='navigationinterceptoptions' data-dfn-type='dictionary'><c- g>NavigationInterceptOptions</c-></dfn> {
  <a href='#navigationprecommithandler' id='the-navigateevent-interface:navigationprecommithandler'><c- n>NavigationPrecommitHandler</c-></a> <dfn data-dfn-for='NavigationInterceptOptions' id='dom-navigationinterceptoptions-precommithandler' data-dfn-type='dict-member'><c- g>precommitHandler</c-></dfn>;
  <a href='#navigationintercepthandler' id='the-navigateevent-interface:navigationintercepthandler'><c- n>NavigationInterceptHandler</c-></a> <dfn data-dfn-for='NavigationInterceptOptions' id='dom-navigationinterceptoptions-handler' data-dfn-type='dict-member'><c- g>handler</c-></dfn>;
  <a href='#navigationfocusreset' id='the-navigateevent-interface:navigationfocusreset'><c- n>NavigationFocusReset</c-></a> <dfn data-dfn-for='NavigationInterceptOptions' id='dom-navigationinterceptoptions-focusreset' data-dfn-type='dict-member'><c- g>focusReset</c-></dfn>;
  <a href='#navigationscrollbehavior' id='the-navigateevent-interface:navigationscrollbehavior'><c- n>NavigationScrollBehavior</c-></a> <dfn data-dfn-for='NavigationInterceptOptions' id='dom-navigationinterceptoptions-scroll' data-dfn-type='dict-member'><c- g>scroll</c-></dfn>;
};

<c- b>enum</c-> <dfn id='navigationfocusreset' data-dfn-type='enum'><c- g>NavigationFocusReset</c-></dfn> {
  <c- s>&quot;</c-><dfn data-dfn-for='NavigationFocusReset' id='dom-navigationfocusreset-after-transition' data-dfn-type='enum-value'><c- s>after-transition</c-></dfn><c- s>&quot;</c->,
  <c- s>&quot;</c-><dfn data-dfn-for='NavigationFocusReset' id='dom-navigationfocusreset-manual' data-dfn-type='enum-value'><c- s>manual</c-></dfn><c- s>&quot;</c->
};

<c- b>enum</c-> <dfn id='navigationscrollbehavior' data-dfn-type='enum'><c- g>NavigationScrollBehavior</c-></dfn> {
  <c- s>&quot;</c-><dfn data-dfn-for='NavigationScrollBehavior' id='dom-navigationscrollbehavior-after-transition' data-dfn-type='enum-value'><c- s>after-transition</c-></dfn><c- s>&quot;</c->,
  <c- s>&quot;</c-><dfn data-dfn-for='NavigationScrollBehavior' id='dom-navigationscrollbehavior-manual' data-dfn-type='enum-value'><c- s>manual</c-></dfn><c- s>&quot;</c->
};

<c- b>callback</c-> <dfn id='navigationintercepthandler' data-dfn-type='callback'><c- g>NavigationInterceptHandler</c-></dfn> = <a href='https://webidl.spec.whatwg.org/#idl-promise' id='the-navigateevent-interface:idl-promise' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<c- b>undefined</c->&gt; ();</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-navigateevent-navigationtype id=dom-navigateevent-navigationtype-dev>navigationType</a></code><dd><p>One of "<code id=the-navigateevent-interface:dom-navigationtype-push-2><a href=#dom-navigationtype-push>push</a></code>", "<code id=the-navigateevent-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>", "<code id=the-navigateevent-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", or "<code id=the-navigateevent-interface:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>", indicating what type of navigation this
   is.<dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=dom-navigateevent-destination-dev>destination</a></code><dd><p>A <code id=the-navigateevent-interface:navigationdestination-3><a href=#navigationdestination>NavigationDestination</a></code> representing the destination of the
   navigation.<dt><code><var>event</var>.<a href=#dom-navigateevent-canintercept id=dom-navigateevent-canintercept-dev>canIntercept</a></code><dd>
    <p>True if <code id=the-navigateevent-interface:dom-navigateevent-intercept-2><a href=#dom-navigateevent-intercept>intercept()</a></code> can be called to
    intercept this navigation and convert it into a same-document navigation, replacing its usual
    behavior; false otherwise.</p>

    <p>Generally speaking, this will be true whenever the current <code id=the-navigateevent-interface:document><a href=dom.html#document>Document</a></code> <a href=#can-have-its-url-rewritten id=the-navigateevent-interface:can-have-its-url-rewritten>can
    have its URL rewritten</a> to the destination URL, except for in the case of cross-document
    "<code id=the-navigateevent-interface:dom-navigationtype-traverse-2><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations, where it will always
    be false.</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-userinitiated id=dom-navigateevent-userinitiated-dev>userInitiated</a></code><dd><p>True if this navigation was due to a user clicking on an <code id=the-navigateevent-interface:the-a-element><a href=text-level-semantics.html#the-a-element>a</a></code> element,
   submitting a <code id=the-navigateevent-interface:the-form-element><a href=forms.html#the-form-element>form</a></code> element, or using the <a href=speculative-loading.html#nav-traversal-ui>browser UI</a>
   to navigate; false otherwise.<dt><code><var>event</var>.<a href=#dom-navigateevent-hashchange id=dom-navigateevent-hashchange-dev>hashChange</a></code><dd><p>True for a <a href=browsing-the-web.html#navigate-fragid id=the-navigateevent-interface:navigate-fragid>fragment navigation</a>; false
   otherwise.<dt><code><var>event</var>.<a href=#dom-navigateevent-signal id=dom-navigateevent-signal-dev>signal</a></code><dd>
    <p>An <code id=the-navigateevent-interface:abortsignal-3><a data-x-internal=abortsignal href=https://dom.spec.whatwg.org/#abortsignal>AbortSignal</a></code> which will become aborted if the navigation gets canceled, e.g.,
    by the user pressing their browser's "Stop" button, or by another navigation interrupting this
    one.</p>

    <p>The expected pattern is for developers to pass this along to any async operations, such as
    <code id=the-navigateevent-interface:fetch()><a data-x-internal=fetch() href=https://fetch.spec.whatwg.org/#dom-global-fetch>fetch()</a></code>, which they perform as part of handling this navigation.</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-formdata id=dom-navigateevent-formdata-dev>formData</a></code><dd>
    <p>The <code id=the-navigateevent-interface:formdata-3><a data-x-internal=formdata href=https://xhr.spec.whatwg.org/#formdata>FormData</a></code> representing the submitted form entries for this navigation, if
    this navigation is a "<code id=the-navigateevent-interface:dom-navigationtype-push-3><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigateevent-interface:dom-navigationtype-replace-2><a href=#dom-navigationtype-replace>replace</a></code>" navigation representing a POST <a href=form-control-infrastructure.html#concept-form-submit id=the-navigateevent-interface:concept-form-submit>form submission</a>; null otherwise.</p>

    <p>(Notably, this will be null even for "<code id=the-navigateevent-interface:dom-navigationtype-reload-2><a href=#dom-navigationtype-reload>reload</a></code>"
    or "<code id=the-navigateevent-interface:dom-navigationtype-traverse-3><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations that are revisiting
    a <a id=the-navigateevent-interface:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a> that was originally created from a form submission.)</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-downloadrequest id=dom-navigateevent-downloadrequest-dev>downloadRequest</a></code><dd>
    <p>Represents whether or not this navigation was requested to be a download, by using an
    <code id=the-navigateevent-interface:the-a-element-2><a href=text-level-semantics.html#the-a-element>a</a></code> or <code id=the-navigateevent-interface:the-area-element><a href=image-maps.html#the-area-element>area</a></code> element's <code id=the-navigateevent-interface:attr-hyperlink-download><a href=links.html#attr-hyperlink-download>download</a></code> attribute:</p>

    <ul><li><p>If a download was not requested, then this property is null.<li><p>If a download was requested, returns the filename that was supplied as the <code id=the-navigateevent-interface:attr-hyperlink-download-2><a href=links.html#attr-hyperlink-download>download</a></code> attribute's value. (This could be the empty
     string.)</ul>

    <p>Note that a download being requested does not always mean that a download will happen: for
    example, a download might be blocked by browser security policies, or end up being treated as a
    "<code id=the-navigateevent-interface:navigationhistorybehavior-push><a href=browsing-the-web.html#navigationhistorybehavior-push>push</a></code>" navigation for <a href=https://github.com/whatwg/html/issues/7718 class=XXX>unspecified reasons</a>.</p>

    <p>Similarly, a navigation might end up being a download even if it was not requested to be one,
    due to the destination server responding with a `<code id=the-navigateevent-interface:http-content-disposition><a data-x-internal=http-content-disposition href=https://httpwg.org/specs/rfc6266.html>Content-Disposition: attachment</a></code>` header.</p>

    <p>Finally, note that the <code id=the-navigateevent-interface:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event will not fire at
    all for downloads initiated using browser UI affordances, e.g., those created by right-clicking
    and choosing to save the target of a link.</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-info id=dom-navigateevent-info-dev>info</a></code><dd><p>An arbitrary JavaScript value passed via one of the <a href=#navigation-api-initiating-navigations>navigation API methods</a> which initiated this
   navigation, or undefined if the navigation was initiated by the user or by a different
   API.<dt><code><var>event</var>.<a href=#dom-navigateevent-hasuavisualtransition id=dom-navigateevent-hasuavisualtransition-dev>hasUAVisualTransition</a></code><dd><p>Returns true if the user agent performed a visual transition for this navigation before
   dispatching this event. If true, the best user experience will be given if the author
   synchronously updates the DOM to the post-navigation state.<dt><code><var>event</var>.<a href=#dom-navigateevent-sourceelement id=dom-navigateevent-sourceelement-dev>sourceElement</a></code><dd><p>Returns the <code id=the-navigateevent-interface:element><a data-x-internal=element href=https://dom.spec.whatwg.org/#interface-element>Element</a></code> responsible for this navigation. This can be an
   <code id=the-navigateevent-interface:the-a-element-3><a href=text-level-semantics.html#the-a-element>a</a></code>or <code id=the-navigateevent-interface:the-area-element-2><a href=image-maps.html#the-area-element>area</a></code> element, a <a href=forms.html#concept-submit-button id=the-navigateevent-interface:concept-submit-button>submit button</a>, or a submitted <code id=the-navigateevent-interface:the-form-element-2><a href=forms.html#the-form-element>form</a></code>
   element.<dt><code><var>event</var>.<a href=#dom-navigateevent-intercept id=dom-navigateevent-intercept-dev>intercept</a>({ <a href=#dom-navigationinterceptoptions-precommithandler id=dom-navigationinterceptoptions-precommithandler-dev>precommitHandler</a>, <a href=#dom-navigationinterceptoptions-handler id=dom-navigationinterceptoptions-handler-dev>handler</a>, <a href=#dom-navigationinterceptoptions-focusreset id=dom-navigationinterceptoptions-focusreset-dev>focusReset</a>, <a href=#dom-navigationinterceptoptions-scroll id=dom-navigationinterceptoptions-scroll-dev>scroll</a> })</code><dd>
    <p>Intercepts this navigation, preventing its normal handling and instead converting it into a
    same-document navigation of the same type to the destination URL.</p>

    <p>The <code id=the-navigateevent-interface:dom-navigationinterceptoptions-precommithandler><a href=#dom-navigationinterceptoptions-precommithandler>precommitHandler</a></code>
    option can be a function that accepts a <code id=the-navigateevent-interface:navigationprecommitcontroller><a href=#navigationprecommitcontroller>NavigationPrecommitController</a></code> and returns a
    promise. The precommit handler function will run after the <code id=the-navigateevent-interface:event-navigate-2><a href=indices.html#event-navigate>navigate</a></code> event has finished firing, but before the <code id=the-navigateevent-interface:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> property has been updated.
    Returning a rejected promise will abort the navigation and its effect, such as updating the URL
    and session history. After all the precommit handlers are fulfilled, the navigation can proceed
    to commit and call the rest of the handlers. The <code id=the-navigateevent-interface:dom-navigationinterceptoptions-precommithandler-2><a href=#dom-navigationinterceptoptions-precommithandler>precommitHandler</a></code> option can only
    be passed when the event is <code id=the-navigateevent-interface:dom-event-cancelable><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code>: trying to
    pass a <code id=the-navigateevent-interface:dom-navigationinterceptoptions-precommithandler-3><a href=#dom-navigationinterceptoptions-precommithandler>precommitHandler</a></code> to
    a non-cancelable <code id=the-navigateevent-interface:navigateevent-2><a href=#navigateevent>NavigateEvent</a></code> will throw a
    <a id=the-navigateevent-interface:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-navigateevent-interface:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>

    <p>The <code id=the-navigateevent-interface:dom-navigationinterceptoptions-handler><a href=#dom-navigationinterceptoptions-handler>handler</a></code> option can be a
    function that returns a promise. The handler function will run after the <code id=the-navigateevent-interface:event-navigate-3><a href=indices.html#event-navigate>navigate</a></code> event has finished firing and the <code id=the-navigateevent-interface:dom-navigation-currententry-2><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> property has been updated.
    This returned promise is used to signal the duration, and success or failure, of the navigation.
    After it settles, the browser signals to the user (e.g., via a loading spinner UI, or assistive
    technology) that the navigation is finished. Additionally, it fires <code id=the-navigateevent-interface:event-navigatesuccess><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code> or <code id=the-navigateevent-interface:event-navigateerror><a href=indices.html#event-navigateerror>navigateerror</a></code> events as appropriate, which other parts of
    the web application can respond to.</p>

    <p>By default, using this method will cause focus to reset when any handlers' returned promises
    settle. Focus will be reset to the first element with the <code id=the-navigateevent-interface:attr-fe-autofocus><a href=interaction.html#attr-fe-autofocus>autofocus</a></code> attribute set, or <a id=the-navigateevent-interface:the-body-element-2 href=dom.html#the-body-element-2>the body element</a> if
    the attribute isn't present. The <code id=the-navigateevent-interface:dom-navigationinterceptoptions-focusreset><a href=#dom-navigationinterceptoptions-focusreset>focusReset</a></code> option can be set to "<code id=the-navigateevent-interface:dom-navigationfocusreset-manual><a href=#dom-navigationfocusreset-manual>manual</a></code>" to avoid this behavior.</p>

    <p>By default, using this method will delay the browser's scroll restoration logic for "<code id=the-navigateevent-interface:dom-navigationtype-traverse-4><a href=#dom-navigationtype-traverse>traverse</a></code>" or "<code id=the-navigateevent-interface:dom-navigationtype-reload-3><a href=#dom-navigationtype-reload>reload</a></code>" navigations, or its
    scroll-reset/scroll-to-a-fragment logic for "<code id=the-navigateevent-interface:dom-navigationtype-push-4><a href=#dom-navigationtype-push>push</a></code>"
    or "<code id=the-navigateevent-interface:dom-navigationtype-replace-3><a href=#dom-navigationtype-replace>replace</a></code>" navigations, until any handlers'
    returned promises settle. The <code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code>
    option can be set to "<code id=the-navigateevent-interface:dom-navigationscrollbehavior-manual><a href=#dom-navigationscrollbehavior-manual>manual</a></code>" to turn
    off any browser-driven scroll behavior entirely for this navigation, or <code id=the-navigateevent-interface:dom-navigateevent-scroll-2><a href=#dom-navigateevent-scroll>scroll()</a></code> can be called before the promise settles to
    trigger this behavior early.</p>

    <p>This method will throw a <a id=the-navigateevent-interface:securityerror-2 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-navigateevent-interface:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>
    if <code id=the-navigateevent-interface:dom-navigateevent-canintercept-2><a href=#dom-navigateevent-canintercept>canIntercept</a></code> is false, or if <code id=the-navigateevent-interface:dom-event-istrusted><a data-x-internal=dom-event-istrusted href=https://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted</a></code> is false. It will throw an
    <a id=the-navigateevent-interface:invalidstateerror href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=the-navigateevent-interface:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> if not called
    synchronously, during event dispatch.</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-scroll id=dom-navigateevent-scroll-dev>scroll</a>()</code><dd>
    <p>For "<code id=the-navigateevent-interface:dom-navigationtype-traverse-5><a href=#dom-navigationtype-traverse>traverse</a></code>" or "<code id=the-navigateevent-interface:dom-navigationtype-reload-4><a href=#dom-navigationtype-reload>reload</a></code>" navigations, restores the scroll position
    using the browser's usual scroll restoration logic.</p>

    <p>For "<code id=the-navigateevent-interface:dom-navigationtype-push-5><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigateevent-interface:dom-navigationtype-replace-4><a href=#dom-navigationtype-replace>replace</a></code>" navigations, either resets the scroll
    position to the top of the document or scrolls to the <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-navigateevent-interface:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a> specified by <code id=the-navigateevent-interface:dom-navigationdestination-url><a href=#dom-navigationdestination-url>destination.url</a></code> if there is one.</p>

    <p>If called more than once, or called after automatic post-transition scroll processing has
    happened due to the <code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll-2><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code> option
    being left as "<code id=the-navigateevent-interface:dom-navigationscrollbehavior-after-transition><a href=#dom-navigationscrollbehavior-after-transition>after-transition</a></code>", or called
    before the navigation has committed, this method will throw an
    <a id=the-navigateevent-interface:invalidstateerror-2 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=the-navigateevent-interface:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</p>
   </dl>

  

  <p>Each <code id=the-navigateevent-interface:navigateevent-3><a href=#navigateevent>NavigateEvent</a></code> has an <dfn id=concept-navigateevent-interception-state>interception state</dfn>, which is either "<code>none</code>", "<code>intercepted</code>", "<code>committed</code>",
  "<code>scrolled</code>", or "<code>finished</code>", initially "<code>none</code>".</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-4><a href=#navigateevent>NavigateEvent</a></code> has a <dfn id=concept-navigateevent-navigation-precommit-handler-list>navigation precommit handler
  list</dfn>, a <a id=the-navigateevent-interface:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <code id=the-navigateevent-interface:navigationprecommithandler-2><a href=#navigationprecommithandler>NavigationPrecommitHandler</a></code> callbacks, initially
  empty.</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-5><a href=#navigateevent>NavigateEvent</a></code> has a <dfn id=concept-navigateevent-navigation-handler-list>navigation handler list</dfn>, a
  <a id=the-navigateevent-interface:list-2 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <code id=the-navigateevent-interface:navigationintercepthandler-2><a href=#navigationintercepthandler>NavigationInterceptHandler</a></code> callbacks, initially empty.</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-6><a href=#navigateevent>NavigateEvent</a></code> has a <dfn id=concept-navigateevent-focusreset>focus
  reset behavior</dfn>, a <code id=the-navigateevent-interface:navigationfocusreset-2><a href=#navigationfocusreset>NavigationFocusReset</a></code>-or-null, initially null.</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-7><a href=#navigateevent>NavigateEvent</a></code> has a <dfn id=concept-navigateevent-scroll>scroll
  behavior</dfn>, a <code id=the-navigateevent-interface:navigationscrollbehavior-2><a href=#navigationscrollbehavior>NavigationScrollBehavior</a></code>-or-null, initially null.</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-8><a href=#navigateevent>NavigateEvent</a></code> has an <dfn id=concept-navigateevent-abort-controller>abort controller</dfn>, an
  <code id=the-navigateevent-interface:abortcontroller><a data-x-internal=abortcontroller href=https://dom.spec.whatwg.org/#abortcontroller>AbortController</a></code>-or-null, initially null.</p>

  <p>Each <code id=the-navigateevent-interface:navigateevent-9><a href=#navigateevent>NavigateEvent</a></code> has a <dfn id=concept-navigateevent-classic-history-api-state>classic history API state</dfn>, a
  <a id=the-navigateevent-interface:serialized-state href=browsing-the-web.html#serialized-state>serialized state</a> or null. It is only used in some cases where the event's <code id=the-navigateevent-interface:dom-navigateevent-navigationtype-2><a href=#dom-navigateevent-navigationtype>navigationType</a></code> is "<code id=the-navigateevent-interface:dom-navigationtype-push-6><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigateevent-interface:dom-navigationtype-replace-5><a href=#dom-navigationtype-replace>replace</a></code>", and is set appropriately when the event is
  <a href=https://dom.spec.whatwg.org/#concept-event-fire id=the-navigateevent-interface:concept-event-fire data-x-internal=concept-event-fire>fired</a>.</p>

  <p>The <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-navigationtype data-dfn-type=attribute><code>navigationType</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-destination data-dfn-type=attribute><code>destination</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-canintercept data-dfn-type=attribute><code>canIntercept</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-userinitiated data-dfn-type=attribute><code>userInitiated</code></dfn>,
  <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-hashchange data-dfn-type=attribute><code>hashChange</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-signal data-dfn-type=attribute><code>signal</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-formdata data-dfn-type=attribute><code>formData</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-downloadrequest data-dfn-type=attribute><code>downloadRequest</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-info data-dfn-type=attribute><code>info</code></dfn>, <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-hasuavisualtransition data-dfn-type=attribute><code>hasUAVisualTransition</code></dfn>, and
  <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-sourceelement data-dfn-type=attribute><code>sourceElement</code></dfn> attributes
  must return the values they are initialized to.</p>

  <p>The <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-intercept data-dfn-type=method><code>intercept(<var>options</var>)</code></dfn> method steps
  are:</p>

  <ol><li><p><a href=#navigateevent-perform-shared-checks id=the-navigateevent-interface:navigateevent-perform-shared-checks>Perform shared checks</a> given
   <a id=the-navigateevent-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.<li><p>If <a id=the-navigateevent-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <code id=the-navigateevent-interface:dom-navigateevent-canintercept-3><a href=#dom-navigateevent-canintercept>canIntercept</a></code>
   attribute was initialized to false, then throw a <a id=the-navigateevent-interface:securityerror-3 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-navigateevent-interface:domexception-5><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-navigateevent-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigateevent-interface:dispatch-flag href=https://dom.spec.whatwg.org/#dispatch-flag data-x-internal=dispatch-flag>dispatch flag</a> is unset, then throw an
   <a id=the-navigateevent-interface:invalidstateerror-3 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=the-navigateevent-interface:domexception-6><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li>
    <p>If <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-precommithandler-4><a href=#dom-navigationinterceptoptions-precommithandler>precommitHandler</a></code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigateevent-interface:map-exists data-x-internal=map-exists>exists</a>, then:</p>

    <ol><li><p> If <a id=the-navigateevent-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <code id=the-navigateevent-interface:dom-event-cancelable-2><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> attribute
     is initialized to false, then throw an <a id=the-navigateevent-interface:invalidstateerror-4 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
     <code id=the-navigateevent-interface:domexception-7><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a href=https://infra.spec.whatwg.org/#list-append id=the-navigateevent-interface:list-append data-x-internal=list-append>Append</a> <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-precommithandler-5><a href=#dom-navigationinterceptoptions-precommithandler>precommitHandler</a></code>"] to
     <a id=the-navigateevent-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-navigation-precommit-handler-list id=the-navigateevent-interface:concept-navigateevent-navigation-precommit-handler-list>navigation precommit handler
     list</a>.</ol>
   <li><p><a id=the-navigateevent-interface:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <a id=the-navigateevent-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-interception-state id=the-navigateevent-interface:concept-navigateevent-interception-state>interception state</a> is either "<code>none</code>" or "<code>intercepted</code>".<li><p>Set <a id=the-navigateevent-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-interception-state id=the-navigateevent-interface:concept-navigateevent-interception-state-2>interception state</a> to "<code>intercepted</code>".<li><p>If <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-handler-2><a href=#dom-navigationinterceptoptions-handler>handler</a></code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigateevent-interface:map-exists-2 data-x-internal=map-exists>exists</a>, then <a href=https://infra.spec.whatwg.org/#list-append id=the-navigateevent-interface:list-append-2 data-x-internal=list-append>append</a> it to <a id=the-navigateevent-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s
   <a href=#concept-navigateevent-navigation-handler-list id=the-navigateevent-interface:concept-navigateevent-navigation-handler-list>navigation handler
   list</a>.<li>
    <p>If <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-focusreset-2><a href=#dom-navigationinterceptoptions-focusreset>focusReset</a></code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigateevent-interface:map-exists-3 data-x-internal=map-exists>exists</a>, then:</p>

    <ol><li><p>If <a id=the-navigateevent-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-focusreset id=the-navigateevent-interface:concept-navigateevent-focusreset>focus reset
     behavior</a> is not null, and it is not equal to <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-focusreset-3><a href=#dom-navigationinterceptoptions-focusreset>focusReset</a></code>"], then the user agent may
     <a id=the-navigateevent-interface:report-a-warning-to-the-console href=https://console.spec.whatwg.org/#report-a-warning-to-the-console data-x-internal=report-a-warning-to-the-console>report a warning to the console</a> indicating that the <code id=the-navigateevent-interface:dom-navigationinterceptoptions-focusreset-4><a href=#dom-navigationinterceptoptions-focusreset>focusReset</a></code> option for a previous call
     to <code id=the-navigateevent-interface:dom-navigateevent-intercept-3><a href=#dom-navigateevent-intercept>intercept()</a></code> was overridden by this new
     value, and the previous value will be ignored.<li><p>Set <a id=the-navigateevent-interface:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-focusreset id=the-navigateevent-interface:concept-navigateevent-focusreset-2>focus reset
     behavior</a> to <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-focusreset-5><a href=#dom-navigationinterceptoptions-focusreset>focusReset</a></code>"].</ol>
   <li>
    <p>If <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll-3><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code>"]
    <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigateevent-interface:map-exists-4 data-x-internal=map-exists>exists</a>, then:</p>

    <ol><li><p>If <a id=the-navigateevent-interface:this-11 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-scroll id=the-navigateevent-interface:concept-navigateevent-scroll>scroll
     behavior</a> is not null, and it is not equal to <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll-4><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code>"], then the user agent may
     <a id=the-navigateevent-interface:report-a-warning-to-the-console-2 href=https://console.spec.whatwg.org/#report-a-warning-to-the-console data-x-internal=report-a-warning-to-the-console>report a warning to the console</a> indicating that the <code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll-5><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code> option for a previous call to
     <code id=the-navigateevent-interface:dom-navigateevent-intercept-4><a href=#dom-navigateevent-intercept>intercept()</a></code> was overridden by this new value,
     and the previous value will be ignored.<li><p>Set <a id=the-navigateevent-interface:this-12 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-scroll id=the-navigateevent-interface:concept-navigateevent-scroll-2>scroll
     behavior</a> to <var>options</var>["<code id=the-navigateevent-interface:dom-navigationinterceptoptions-scroll-6><a href=#dom-navigationinterceptoptions-scroll>scroll</a></code>"].</ol>
   </ol>

  <p>The <dfn data-dfn-for=NavigateEvent id=dom-navigateevent-scroll data-dfn-type=method><code>scroll()</code></dfn> method steps are:</p>

  <ol><li><p><a href=#navigateevent-perform-shared-checks id=the-navigateevent-interface:navigateevent-perform-shared-checks-2>Perform shared checks</a> given
   <a id=the-navigateevent-interface:this-13 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.<li><p>If <a id=the-navigateevent-interface:this-14 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigateevent-interception-state id=the-navigateevent-interface:concept-navigateevent-interception-state-3>interception state</a> is not "<code>committed</code>", then throw an <a id=the-navigateevent-interface:invalidstateerror-5 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
   <code id=the-navigateevent-interface:domexception-8><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p><a href=#process-scroll-behavior id=the-navigateevent-interface:process-scroll-behavior>Process scroll behavior</a> given <a id=the-navigateevent-interface:this-15 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>.</ol>

  <p>To <dfn id=navigateevent-perform-shared-checks>perform shared checks</dfn> for a
  <code id=the-navigateevent-interface:navigateevent-10><a href=#navigateevent>NavigateEvent</a></code> <var>event</var>:</p>

  <ol><li><p>If <var>event</var>'s <a id=the-navigateevent-interface:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigateevent-interface:concept-document-window>associated <code>Document</code></a> is not <a id=the-navigateevent-interface:fully-active href=document-sequences.html#fully-active>fully
   active</a>, then throw an <a id=the-navigateevent-interface:invalidstateerror-6 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
   <code id=the-navigateevent-interface:domexception-9><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>event</var>'s <code id=the-navigateevent-interface:dom-event-istrusted-2><a data-x-internal=dom-event-istrusted href=https://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted</a></code> attribute was
   initialized to false, then throw a <a id=the-navigateevent-interface:securityerror-4 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
   <code id=the-navigateevent-interface:domexception-10><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>event</var>'s <a id=the-navigateevent-interface:canceled-flag href=https://dom.spec.whatwg.org/#canceled-flag data-x-internal=canceled-flag>canceled flag</a> is set, then throw an
   <a id=the-navigateevent-interface:invalidstateerror-7 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=the-navigateevent-interface:domexception-11><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.</ol>


  

  <h6 id=the-navigationprecommitcontroller-interface><span class=secno>7.2.6.10.2</span> The <code id=the-navigationprecommitcontroller-interface:navigationprecommitcontroller><a href=#navigationprecommitcontroller>NavigationPrecommitController</a></code> interface<a href=#the-navigationprecommitcontroller-interface class=self-link></a></h6>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
  <c- b>interface</c-> <dfn id='navigationprecommitcontroller' data-dfn-type='interface'><c- g>NavigationPrecommitController</c-></dfn> {
    <c- b>undefined</c-> <a href='#dom-navigationprecommitcontroller-redirect' id='the-navigationprecommitcontroller-interface:dom-navigationprecommitcontroller-redirect'><c- g>redirect</c-></a>(<c- b>USVString</c-> <c- g>url</c->, <c- b>optional</c-> <a href='#navigationnavigateoptions' id='the-navigationprecommitcontroller-interface:navigationnavigateoptions'><c- n>NavigationNavigateOptions</c-></a> <c- g>options</c-> = {});
  };

  <c- b>callback</c-> <dfn id='navigationprecommithandler' data-dfn-type='callback'><c- g>NavigationPrecommitHandler</c-></dfn> = <a href='https://webidl.spec.whatwg.org/#idl-promise' id='the-navigationprecommitcontroller-interface:idl-promise' data-x-internal='idl-promise'><c- b>Promise</c-></a>&lt;<c- b>undefined</c->&gt; (<a href='#navigationprecommitcontroller' id='the-navigationprecommitcontroller-interface:navigationprecommitcontroller-2'><c- n>NavigationPrecommitController</c-></a> <c- g>controller</c->);</code></pre>

  <dl class=domintro><dt><code><var>precommitController</var>.<a href=#dom-navigationprecommitcontroller-redirect id=dom-navigationprecommitcontroller-redirect-dev>redirect</a>(USVString <var>url</var>, <a href=#navigationnavigateoptions id=the-navigationprecommitcontroller-interface:navigationnavigateoptions-2>NavigationNavigateOptions</a> <var>options</var>)</code><dd>
    <p>For "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>" navigations, sets the <code id=the-navigationprecommitcontroller-interface:dom-navigationdestination-url><a href=#dom-navigationdestination-url>destination.url</a></code> to <var>url</var>.</p>

    <p>If <var>options</var> is given, also sets the <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-info><a href=#dom-navigateevent-info>info</a></code> and the resulting
    <code id=the-navigationprecommitcontroller-interface:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>'s <a href=#concept-navigationdestination-state id=the-navigationprecommitcontroller-interface:concept-navigationdestination-state>state</a> to <var>options</var>'s <code id=the-navigationprecommitcontroller-interface:dom-navigationoptions-info><a href=#dom-navigationoptions-info>info</a></code> and <code id=the-navigationprecommitcontroller-interface:dom-navigationnavigateoptions-state><a href=#dom-navigationnavigateoptions-state>state</a></code>, if they are present. The <code id=the-navigationprecommitcontroller-interface:dom-navigationnavigateoptions-history><a href=#dom-navigationnavigateoptions-history>history</a></code> option can also switch between
    "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-push-2><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-replace-2><a href=#dom-navigationtype-replace>replace</a></code>" navigations types.</p>

    <p>For "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>" or "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations, an
    <a id=the-navigationprecommitcontroller-interface:invalidstateerror href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> will be thrown.</p>

    <p>If the current <code id=the-navigationprecommitcontroller-interface:document><a href=dom.html#document>Document</a></code> <a href=#can-have-its-url-rewritten id=the-navigationprecommitcontroller-interface:can-have-its-url-rewritten>cannot have
    its URL rewritten</a> to <var>url</var>, a <a id=the-navigationprecommitcontroller-interface:securityerror href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a>
    <code id=the-navigationprecommitcontroller-interface:domexception><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code> will be thrown.</p>
  </dl>

  

  <p>Each <code id=the-navigationprecommitcontroller-interface:navigationprecommitcontroller-3><a href=#navigationprecommitcontroller>NavigationPrecommitController</a></code> has a <code id=the-navigationprecommitcontroller-interface:navigateevent><a href=#navigateevent>NavigateEvent</a></code> <dfn id=concept-navigationprecommitcontroller-event>event</dfn>.</p>

  <p>The <dfn data-dfn-for=NavigationPrecommitController id=dom-navigationprecommitcontroller-redirect data-dfn-type=method><code>redirect(<var>url</var>,
  <var>options</var>)</code></dfn> method steps are:</p>

  <ol><li><p><a id=the-navigationprecommitcontroller-interface:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <a id=the-navigationprecommitcontroller-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event>event</a>'s <a href=#concept-navigateevent-interception-state id=the-navigationprecommitcontroller-interface:concept-navigateevent-interception-state>interception state</a> is not "<code>none</code>".<li><p><a href=#navigateevent-perform-shared-checks id=the-navigationprecommitcontroller-interface:navigateevent-perform-shared-checks>Perform shared checks</a> given
   <a id=the-navigationprecommitcontroller-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-2>event</a>.<li><p>If <a id=the-navigationprecommitcontroller-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-3>event</a>'s <a href=#concept-navigateevent-interception-state id=the-navigationprecommitcontroller-interface:concept-navigateevent-interception-state-2>interception state</a> is not "<code>intercepted</code>", then throw an <a id=the-navigationprecommitcontroller-interface:invalidstateerror-2 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a>
   <code id=the-navigationprecommitcontroller-interface:domexception-2><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <a id=the-navigationprecommitcontroller-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-4>event</a>'s <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-navigationtype><a href=#dom-navigateevent-navigationtype>navigationType</a></code> is neither "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-push-3><a href=#dom-navigationtype-push>push</a></code>" nor "<code id=the-navigationprecommitcontroller-interface:dom-navigationtype-replace-3><a href=#dom-navigationtype-replace>replace</a></code>", then throw an
   <a id=the-navigationprecommitcontroller-interface:invalidstateerror-3 href=https://webidl.spec.whatwg.org/#invalidstateerror data-x-internal=invalidstateerror>"<code>InvalidStateError</code>"</a> <code id=the-navigationprecommitcontroller-interface:domexception-3><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>Let <var>document</var> be <a id=the-navigationprecommitcontroller-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a id=the-navigationprecommitcontroller-interface:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=the-navigationprecommitcontroller-interface:concept-document-window>associated <code>Document</code></a>.<li><p>Let <var>destinationURL</var> be the result of <a href=urls-and-fetching.html#parse-a-url id=the-navigationprecommitcontroller-interface:parse-a-url>parsing</a>
   <var>url</var> given <var>document</var>.<li><p>If <var>destinationURL</var> is failure, then throw a
   <a id=the-navigationprecommitcontroller-interface:syntaxerror href=https://webidl.spec.whatwg.org/#syntaxerror data-x-internal=syntaxerror>"<code>SyntaxError</code>"</a> <code id=the-navigationprecommitcontroller-interface:domexception-4><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>document</var> <a href=#can-have-its-url-rewritten id=the-navigationprecommitcontroller-interface:can-have-its-url-rewritten-2>cannot have its URL
   rewritten</a> to <var>destinationURL</var>, then throw a
   <a id=the-navigationprecommitcontroller-interface:securityerror-2 href=https://webidl.spec.whatwg.org/#securityerror data-x-internal=securityerror>"<code>SecurityError</code>"</a> <code id=the-navigationprecommitcontroller-interface:domexception-5><a data-x-internal=domexception href=https://webidl.spec.whatwg.org/#dfn-DOMException>DOMException</a></code>.<li><p>If <var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationnavigateoptions-history-2><a href=#dom-navigationnavigateoptions-history>history</a></code>"] is "<code id=the-navigationprecommitcontroller-interface:navigationhistorybehavior-push><a href=browsing-the-web.html#navigationhistorybehavior-push>push</a></code>" or "<code id=the-navigationprecommitcontroller-interface:navigationhistorybehavior-replace><a href=browsing-the-web.html#navigationhistorybehavior-replace>replace</a></code>", then set <a id=the-navigationprecommitcontroller-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-5>event</a>'s <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-navigationtype-2><a href=#dom-navigateevent-navigationtype>navigationType</a></code> to <var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationnavigateoptions-history-3><a href=#dom-navigationnavigateoptions-history>history</a></code>"].<li>
    <p>If <var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationnavigateoptions-state-2><a href=#dom-navigationnavigateoptions-state>state</a></code>"]
    <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigationprecommitcontroller-interface:map-exists data-x-internal=map-exists>exists</a>, then:</p>

    <ol><li><p>Let <var>serializedState</var> be the result of calling
     <a id=the-navigationprecommitcontroller-interface:structuredserializeforstorage href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(<var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationreloadoptions-state><a href=#dom-navigationreloadoptions-state>state</a></code>"]). This may throw an
     exception.<li><p>Set <a id=the-navigationprecommitcontroller-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-6>event</a>'s <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-destination><a href=#dom-navigateevent-destination>destination</a></code>'s <a href=#concept-navigationdestination-state id=the-navigationprecommitcontroller-interface:concept-navigationdestination-state-2>state</a> to
     <var>serializedState</var>.<li><p>Set <a id=the-navigationprecommitcontroller-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-7>event</a>'s  <a href=https://dom.spec.whatwg.org/#concept-event-target id=the-navigationprecommitcontroller-interface:concept-event-target data-x-internal=concept-event-target>target</a>'s <a href=#ongoing-api-method-tracker id=the-navigationprecommitcontroller-interface:ongoing-api-method-tracker>ongoing API method tracker</a>'s <a href=#navigation-api-method-tracker-state id=the-navigationprecommitcontroller-interface:navigation-api-method-tracker-state>serialized state</a> to
     <var>serializedState</var>.</ol>
   <li><p>Set <a id=the-navigationprecommitcontroller-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-8>event</a>'s <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-destination-2><a href=#dom-navigateevent-destination>destination</a></code>'s <a href=#concept-navigationdestination-url id=the-navigationprecommitcontroller-interface:concept-navigationdestination-url>URL</a> to <var>destinationURL</var>.<li><p>If <var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationoptions-info-2><a href=#dom-navigationoptions-info>info</a></code>"] <a href=https://infra.spec.whatwg.org/#map-exists id=the-navigationprecommitcontroller-interface:map-exists-2 data-x-internal=map-exists>exists</a>, then set <a id=the-navigationprecommitcontroller-interface:this-10 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s  <a href=#concept-navigationprecommitcontroller-event id=the-navigationprecommitcontroller-interface:concept-navigationprecommitcontroller-event-9>event</a>'s <code id=the-navigationprecommitcontroller-interface:dom-navigateevent-info-2><a href=#dom-navigateevent-info>info</a></code> to <var>options</var>["<code id=the-navigationprecommitcontroller-interface:dom-navigationoptions-info-3><a href=#dom-navigationoptions-info>info</a></code>"].</ol>


  

  <h6 id=the-navigationdestination-interface><span class=secno>7.2.6.10.3</span> The <code id=the-navigationdestination-interface:navigationdestination><a href=#navigationdestination>NavigationDestination</a></code> interface<a href=#the-navigationdestination-interface class=self-link></a></h6>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigationdestination' data-dfn-type='interface'><c- g>NavigationDestination</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-navigationdestination-url' id='the-navigationdestination-interface:dom-navigationdestination-url'><c- g>url</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-navigationdestination-key' id='the-navigationdestination-interface:dom-navigationdestination-key'><c- g>key</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-navigationdestination-id' id='the-navigationdestination-interface:dom-navigationdestination-id'><c- g>id</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>long</c-> <c- b>long</c-> <a href='#dom-navigationdestination-index' id='the-navigationdestination-interface:dom-navigationdestination-index'><c- g>index</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-navigationdestination-samedocument' id='the-navigationdestination-interface:dom-navigationdestination-samedocument'><c- g>sameDocument</c-></a>;

  <c- b>any</c-> <a href='#dom-navigationdestination-getstate' id='the-navigationdestination-interface:dom-navigationdestination-getstate'><c- g>getState</c-></a>();
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination>destination</a>.<a href=#dom-navigationdestination-url id=the-navigationdestination-interface:dom-navigationdestination-url-2>url</a></code><dd><p>The URL being navigated to.<dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination-2>destination</a>.<a href=#dom-navigationdestination-key id=the-navigationdestination-interface:dom-navigationdestination-key-2>key</a></code><dd><p>The value of the <code id=the-navigationdestination-interface:dom-navigationhistoryentry-key><a href=#dom-navigationhistoryentry-key>key</a></code> property of the
   destination <code id=the-navigationdestination-interface:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, if this is a "<code id=the-navigationdestination-interface:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>" navigation, or the empty string otherwise. <dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination-3>destination</a>.<a href=#dom-navigationdestination-id id=the-navigationdestination-interface:dom-navigationdestination-id-2>id</a></code><dd><p>The value of the <code id=the-navigationdestination-interface:dom-navigationhistoryentry-id><a href=#dom-navigationhistoryentry-id>id</a></code> property of the
   destination <code id=the-navigationdestination-interface:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, if this is a "<code id=the-navigationdestination-interface:dom-navigationtype-traverse-2><a href=#dom-navigationtype-traverse>traverse</a></code>" navigation, or the empty string otherwise. <dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination-4>destination</a>.<a href=#dom-navigationdestination-index id=the-navigationdestination-interface:dom-navigationdestination-index-2>index</a></code><dd><p>The value of the <code id=the-navigationdestination-interface:dom-navigationhistoryentry-index><a href=#dom-navigationhistoryentry-index>index</a></code> property of
   the destination <code id=the-navigationdestination-interface:navigationhistoryentry-3><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, if this is a "<code id=the-navigationdestination-interface:dom-navigationtype-traverse-3><a href=#dom-navigationtype-traverse>traverse</a></code>" navigation, or −1 otherwise.
   <dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination-5>destination</a>.<a href=#dom-navigationdestination-samedocument id=the-navigationdestination-interface:dom-navigationdestination-samedocument-2>sameDocument</a></code><dd>
    <p>Indicates whether or not this navigation is to the same <code id=the-navigationdestination-interface:document><a href=dom.html#document>Document</a></code> as the current
    one, or not. This will be true, for example, in the case of fragment navigations or <code id=the-navigationdestination-interface:dom-history-pushstate><a href=#dom-history-pushstate>history.pushState()</a></code> navigations.</p>

    <p>Note that this property indicates the original nature of the navigation. If a cross-document
    navigation is converted into a same-document navigation using <code id=the-navigationdestination-interface:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code>, that will not change the
    value of this property.</p>
   <dt><code><var>event</var>.<a href=#dom-navigateevent-destination id=the-navigationdestination-interface:dom-navigateevent-destination-6>destination</a>.<a href=#dom-navigationdestination-getstate id=the-navigationdestination-interface:dom-navigationdestination-getstate-2>getState</a>()</code><dd>
    <p>For "<code id=the-navigationdestination-interface:dom-navigationtype-traverse-4><a href=#dom-navigationtype-traverse>traverse</a></code>" navigations, returns the
    <a href=structured-data.html#structureddeserialize id=the-navigationdestination-interface:structureddeserialize>deserialization</a> of the state stored in the
    destination <a id=the-navigationdestination-interface:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a>.</p>

    <p>For "<code id=the-navigationdestination-interface:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>" or "<code id=the-navigationdestination-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>" navigations, returns the <a href=structured-data.html#structureddeserialize id=the-navigationdestination-interface:structureddeserialize-2>deserialization</a> of the state passed to <code id=the-navigationdestination-interface:dom-navigation-navigate><a href=#dom-navigation-navigate>navigation.navigate()</a></code>, if the navigation was initiated
    by that method, or undefined it if it wasn't.</p>

    <p>For "<code id=the-navigationdestination-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>" navigations, returns the <a href=structured-data.html#structureddeserialize id=the-navigationdestination-interface:structureddeserialize-3>deserialization</a> of the state passed to <code id=the-navigationdestination-interface:dom-navigation-reload><a href=#dom-navigation-reload>navigation.reload()</a></code>, if the reload was initiated by that
    method, or undefined it if it wasn't.</p>
   </dl>

  

  <p>Each <code id=the-navigationdestination-interface:navigationdestination-2><a href=#navigationdestination>NavigationDestination</a></code> has a <dfn id=concept-navigationdestination-url>URL</dfn>, which is a <a id=the-navigationdestination-interface:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a>.</p>

  <p>Each <code id=the-navigationdestination-interface:navigationdestination-3><a href=#navigationdestination>NavigationDestination</a></code> has an <dfn id=concept-navigationdestination-entry>entry</dfn>, which is a
  <code id=the-navigationdestination-interface:navigationhistoryentry-4><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> or null.</p>

  <p class=note>It will be non-null if and only if the <code id=the-navigationdestination-interface:navigationdestination-4><a href=#navigationdestination>NavigationDestination</a></code>
  corresponds to a "<code id=the-navigationdestination-interface:dom-navigationtype-traverse-5><a href=#dom-navigationtype-traverse>traverse</a></code>" navigation.</p>

  <p>Each <code id=the-navigationdestination-interface:navigationdestination-5><a href=#navigationdestination>NavigationDestination</a></code> has a <dfn id=concept-navigationdestination-state>state</dfn>, which is a <a id=the-navigationdestination-interface:serialized-state href=browsing-the-web.html#serialized-state>serialized
  state</a>.</p>

  <p>Each <code id=the-navigationdestination-interface:navigationdestination-6><a href=#navigationdestination>NavigationDestination</a></code> has an <dfn id=concept-navigationdestination-samedocument>is same document</dfn>, which is a
  boolean.</p>

  <hr>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-url data-dfn-type=attribute><code>url</code></dfn> getter steps are to return
  <a id=the-navigationdestination-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-url id=the-navigationdestination-interface:concept-navigationdestination-url>URL</a>, <a href=https://url.spec.whatwg.org/#concept-url-serializer id=the-navigationdestination-interface:concept-url-serializer data-x-internal=concept-url-serializer>serialized</a>.</p>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-key data-dfn-type=attribute><code>key</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-navigationdestination-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry>entry</a> is
   null, then return the empty string.<li><p>Return <a id=the-navigationdestination-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry-2>entry</a>'s <a href=#concept-navigationhistoryentry-key id=the-navigationdestination-interface:concept-navigationhistoryentry-key>key</a>.</ol>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-id data-dfn-type=attribute><code>id</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-navigationdestination-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry-3>entry</a> is
   null, then return the empty string.<li><p>Return <a id=the-navigationdestination-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry-4>entry</a>'s <a href=#concept-navigationhistoryentry-id id=the-navigationdestination-interface:concept-navigationhistoryentry-id>ID</a>.</ol>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-index data-dfn-type=attribute><code>index</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-navigationdestination-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry-5>entry</a> is
   null, then return −1.<li><p>Return <a id=the-navigationdestination-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-entry id=the-navigationdestination-interface:concept-navigationdestination-entry-6>entry</a>'s <a href=#concept-navigationhistoryentry-index id=the-navigationdestination-interface:concept-navigationhistoryentry-index>index</a>.</ol>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-samedocument data-dfn-type=attribute><code>sameDocument</code></dfn> getter steps are to
  return <a id=the-navigationdestination-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-samedocument id=the-navigationdestination-interface:concept-navigationdestination-samedocument>is same
  document</a>.</p>

  <p>The <dfn data-dfn-for=NavigationDestination id=dom-navigationdestination-getstate data-dfn-type=method><code>getState()</code></dfn> method steps are to return
  <a id=the-navigationdestination-interface:structureddeserialize-4 href=structured-data.html#structureddeserialize>StructuredDeserialize</a>(<a id=the-navigationdestination-interface:this-9 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-navigationdestination-state id=the-navigationdestination-interface:concept-navigationdestination-state>state</a>).</p>


  <h6 id=navigate-event-firing><span class=secno>7.2.6.10.4</span> Firing the event<a href=#navigate-event-firing class=self-link></a></h6>

  <p>Other parts of the standard fire the <code id=navigate-event-firing:event-navigate><a href=indices.html#event-navigate>navigate</a></code> event,
  through a series of wrapper algorithms given in this section.</p>

  <p>To <dfn id=fire-a-traverse-navigate-event>fire a traverse <code>navigate</code> event</dfn> at a
  <code id=navigate-event-firing:navigation><a href=#navigation>Navigation</a></code> <var>navigation</var> given a <a id=navigate-event-firing:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a> <dfn id=fire-navigate-traverse-destinationshe><var>destinationSHE</var></dfn> and an optional
  <a id=navigate-event-firing:user-navigation-involvement href=browsing-the-web.html#user-navigation-involvement>user navigation involvement</a> <dfn id=fire-navigate-traverse-userinvolvement><var>userInvolvement</var></dfn> (default "<code id=navigate-event-firing:uni-none><a href=browsing-the-web.html#uni-none>none</a></code>"):</p>

  <ol><li><p>Let <var>event</var> be the result of <a id=navigate-event-firing:creating-an-event href=https://dom.spec.whatwg.org/#concept-event-create data-x-internal=creating-an-event>creating an event</a> given
   <code id=navigate-event-firing:navigateevent><a href=#navigateevent>NavigateEvent</a></code>, in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm>relevant realm</a>.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-classic-history-api-state id=navigate-event-firing:concept-navigateevent-classic-history-api-state>classic history API state</a> to
   null.<li><p>Let <var>destination</var> be a <a id=navigate-event-firing:new href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:navigationdestination><a href=#navigationdestination>NavigationDestination</a></code>
   created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-2>relevant
   realm</a>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url>URL</a>
   to <var>destinationSHE</var>'s <a href=browsing-the-web.html#she-url id=navigate-event-firing:she-url>URL</a>.<li><p>Let <var>destinationNHE</var> be the <code id=navigate-event-firing:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> in
   <var>navigation</var>'s <a href=#navigation-entry-list id=navigate-event-firing:navigation-entry-list>entry list</a> whose <a href=#nhe-she id=navigate-event-firing:nhe-she>session history entry</a> is <var>destinationSHE</var>, or null if no such
   <code id=navigate-event-firing:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code> exists.<li>
    <p>If <var>destinationNHE</var> is non-null, then:</p>

    <ol><li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry>entry</a> to
     <var>destinationNHE</var>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-state id=navigate-event-firing:concept-navigationdestination-state>state</a> to <var>destinationSHE</var>'s <a href=browsing-the-web.html#she-navigation-api-state id=navigate-event-firing:she-navigation-api-state>navigation API state</a>.</ol>
   <li>
    <p>Otherwise,</p>

    <ol><li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-2>entry</a> to null.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-state id=navigate-event-firing:concept-navigationdestination-state-2>state</a> to
     <a id=navigate-event-firing:structuredserializeforstorage href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(null).</ol>
   <li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument>is
   same document</a> to true if <var>destinationSHE</var>'s <a href=browsing-the-web.html#she-document id=navigate-event-firing:she-document>document</a> is equal to <var>navigation</var>'s <a id=navigate-event-firing:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global
   object</a>'s <a href=#concept-document-window id=navigate-event-firing:concept-document-window>associated <code>Document</code></a>;
   otherwise false.<li><p>Return the result of performing the <a href=#inner-navigate-event-firing-algorithm id=navigate-event-firing:inner-navigate-event-firing-algorithm>inner <code>navigate</code> event firing algorithm</a> given
   <var>navigation</var>, "<code id=navigate-event-firing:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>",
   <var>event</var>, <var>destination</var>, <var>userInvolvement</var>, null, null, and
   null.</ol>

  <p>To <dfn id=fire-a-push/replace/reload-navigate-event>fire a push/replace/reload <code>navigate</code> event</dfn> at
  a <code id=navigate-event-firing:navigation-2><a href=#navigation>Navigation</a></code> <var>navigation</var> given a <code id=navigate-event-firing:navigationtype><a href=#navigationtype>NavigationType</a></code> <dfn id=fire-navigate-prr-navigationtype><var>navigationType</var></dfn>, a <a id=navigate-event-firing:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> <dfn id=fire-navigate-prr-destinationurl><var>destinationURL</var></dfn>, a boolean <dfn id=fire-navigate-prr-issamedocument><var>isSameDocument</var></dfn>, an optional <a id=navigate-event-firing:user-navigation-involvement-2 href=browsing-the-web.html#user-navigation-involvement>user
  navigation involvement</a> <dfn id=fire-navigate-prr-userinvolvement><var>userInvolvement</var></dfn> (default "<code id=navigate-event-firing:uni-none-2><a href=browsing-the-web.html#uni-none>none</a></code>"), an optional <code id=navigate-event-firing:element><a data-x-internal=element href=https://dom.spec.whatwg.org/#interface-element>Element</a></code>-or-null <dfn id=fire-navigate-prr-sourceelement><var>sourceElement</var></dfn> (default null), an
  optional <a id=navigate-event-firing:entry-list href=form-control-infrastructure.html#entry-list>entry list</a>-or-null <dfn id=fire-navigate-prr-formdataentrylist><var>formDataEntryList</var></dfn> (default null), an
  optional <a id=navigate-event-firing:serialized-state href=browsing-the-web.html#serialized-state>serialized state</a> <dfn id=fire-navigate-prr-navigationapistate><var>navigationAPIState</var></dfn> (default
  <a id=navigate-event-firing:structuredserializeforstorage-2 href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(null)), and an optional <a id=navigate-event-firing:serialized-state-2 href=browsing-the-web.html#serialized-state>serialized
  state</a>-or-null <dfn id=fire-navigate-prr-classichistoryapistate><var>classicHistoryAPIState</var></dfn> (default
  null):</p>

  <ol><li>
    <p>If <var>isSameDocument</var> is true:</p>

    <ol><li>
      <p><a id=navigate-event-firing:while href=https://infra.spec.whatwg.org/#iteration-while data-x-internal=while>While</a> <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event>ongoing <code>navigate</code> event</a> is not null:</p>

      <ol><li><p><a href=#abort-the-ongoing-navigation id=navigate-event-firing:abort-the-ongoing-navigation>Abort the ongoing navigation</a> given <var>navigation</var>.</ol>

      <div class=note>
       <p>If there is an ongoing cross-document navigation, this means it will be signaled to the
       navigation API as aborted, e.g., by firing <code id=navigate-event-firing:event-navigateerror><a href=indices.html#event-navigateerror>navigateerror</a></code> events. This is somewhat accurate, since
       the next navigation the <code id=navigate-event-firing:document><a href=dom.html#document>Document</a></code> experiences will be this same-document
       navigation, so a developer which was expecting the next navigation completion to be that of
       the cross-document navigation gets a useful signal that this did not happen. However, it is
       also somewhat inaccurate, as the browser will continue to process the ongoing cross-document
       navigation (applying it after this same-document one synchronously finishes).</p>

       <p>Ultimately, the navigation API gets a bit messy with overlapping cross- and same-document
       navigations, as the <a href=#ongoing-navigation-tracking>ongoing navigation tracking</a>
       machinery and APIs are built to expose only a single ongoing navigation. Web developers will
       be best-served if they do not create such overlapping situations, e.g., by <code>await</code>ing promises returned from <code id=navigate-event-firing:dom-navigation-navigate><a href=#dom-navigation-navigate>navigation.navigate()</a></code> before starting new
       navigations.</p>
      </div>

      <p class=note>This is a loop, since <a href=#abort-the-ongoing-navigation id=navigate-event-firing:abort-the-ongoing-navigation-2>abort the ongoing navigation</a> can run
      JavaScript (e.g., via the <code id=navigate-event-firing:event-navigateerror-2><a href=indices.html#event-navigateerror>navigateerror</a></code> event),
      which might start a new navigation. Since such a newly-started navigation will be superseded
      by the completion of this navigation, it gets signaled to the navigation API as aborted.</p>
     </ol>
   <li><p>Let <var>event</var> be the result of <a id=navigate-event-firing:creating-an-event-2 href=https://dom.spec.whatwg.org/#concept-event-create data-x-internal=creating-an-event>creating an event</a> given
   <code id=navigate-event-firing:navigateevent-2><a href=#navigateevent>NavigateEvent</a></code>, in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-3>relevant realm</a>.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-classic-history-api-state id=navigate-event-firing:concept-navigateevent-classic-history-api-state-2>classic history API state</a> to
   <var>classicHistoryAPIState</var>.<li><p>Let <var>destination</var> be a <a id=navigate-event-firing:new-2 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:navigationdestination-2><a href=#navigationdestination>NavigationDestination</a></code>
   created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-4>relevant
   realm</a>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url-2>URL</a>
   to <var>destinationURL</var>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-3>entry</a> to null.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-state id=navigate-event-firing:concept-navigationdestination-state-3>state</a> to
   <var>navigationAPIState</var>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-2>is
   same document</a> to <var>isSameDocument</var>.<li><p>Return the result of performing the <a href=#inner-navigate-event-firing-algorithm id=navigate-event-firing:inner-navigate-event-firing-algorithm-2>inner <code>navigate</code> event firing algorithm</a> given
   <var>navigation</var>, <var>navigationType</var>, <var>event</var>, <var>destination</var>,
   <var>userInvolvement</var>, <var>sourceElement</var>, <var>formDataEntryList</var>, and
   null.</ol>

  <p>To <dfn id=fire-a-download-request-navigate-event>fire a download request <code>navigate</code> event</dfn> at a
  <code id=navigate-event-firing:navigation-3><a href=#navigation>Navigation</a></code> <var>navigation</var> given a <a id=navigate-event-firing:url-2 href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> <dfn id=fire-navigate-download-destinationurl><var>destinationURL</var></dfn>, a <a id=navigate-event-firing:user-navigation-involvement-3 href=browsing-the-web.html#user-navigation-involvement>user
  navigation involvement</a> <dfn id=fire-navigate-download-userinvolvement><var>userInvolvement</var></dfn>, an
  <code id=navigate-event-firing:element-2><a data-x-internal=element href=https://dom.spec.whatwg.org/#interface-element>Element</a></code>-or-null <dfn id=fire-navigate-download-sourceelement><var>sourceElement</var></dfn>, and a string
  <dfn id=fire-navigate-download-filename><var>filename</var></dfn>:</p>

  <ol><li><p>Let <var>event</var> be the result of <a id=navigate-event-firing:creating-an-event-3 href=https://dom.spec.whatwg.org/#concept-event-create data-x-internal=creating-an-event>creating an event</a> given
   <code id=navigate-event-firing:navigateevent-3><a href=#navigateevent>NavigateEvent</a></code>, in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-5>relevant realm</a>.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-classic-history-api-state id=navigate-event-firing:concept-navigateevent-classic-history-api-state-3>classic history API state</a> to
   null.<li><p>Let <var>destination</var> be a <a id=navigate-event-firing:new-3 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:navigationdestination-3><a href=#navigationdestination>NavigationDestination</a></code>
   created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-6>relevant
   realm</a>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url-3>URL</a>
   to <var>destinationURL</var>.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-4>entry</a> to null.<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-state id=navigate-event-firing:concept-navigationdestination-state-4>state</a> to
   <a id=navigate-event-firing:structuredserializeforstorage-3 href=structured-data.html#structuredserializeforstorage>StructuredSerializeForStorage</a>(null).<li><p>Set <var>destination</var>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-3>is
   same document</a> to false.<li><p>Return the result of performing the <a href=#inner-navigate-event-firing-algorithm id=navigate-event-firing:inner-navigate-event-firing-algorithm-3>inner <code>navigate</code> event firing algorithm</a> given
   <var>navigation</var>, "<code id=navigate-event-firing:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>", <var>event</var>,
   <var>destination</var>, <var>userInvolvement</var>, <var>sourceElement</var>, null, and
   <var>filename</var>.</ol>

  <p>The <dfn id=inner-navigate-event-firing-algorithm>inner <code>navigate</code> event firing algorithm</dfn>
  consists of the following steps, given a <code id=navigate-event-firing:navigation-4><a href=#navigation>Navigation</a></code> <var>navigation</var>, a
  <code id=navigate-event-firing:navigationtype-2><a href=#navigationtype>NavigationType</a></code> <var>navigationType</var>, a <code id=navigate-event-firing:navigateevent-4><a href=#navigateevent>NavigateEvent</a></code>
  <var>event</var>, a <code id=navigate-event-firing:navigationdestination-4><a href=#navigationdestination>NavigationDestination</a></code> <var>destination</var>, a <a id=navigate-event-firing:user-navigation-involvement-4 href=browsing-the-web.html#user-navigation-involvement>user
  navigation involvement</a> <var>userInvolvement</var>, an <code id=navigate-event-firing:element-3><a data-x-internal=element href=https://dom.spec.whatwg.org/#interface-element>Element</a></code>-or-null
  <var>sourceElement</var>, an <a id=navigate-event-firing:entry-list-2 href=form-control-infrastructure.html#entry-list>entry list</a>-or-null <var>formDataEntryList</var>, and a
  string-or-null <var>downloadRequestFilename</var>:</p>

  <ol><li>
    <p>If <var>navigation</var> <a href=#has-entries-and-events-disabled id=navigate-event-firing:has-entries-and-events-disabled>has entries and events disabled</a>, then:</p>

    <ol><li><p><a id=navigate-event-firing:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=navigate-event-firing:ongoing-api-method-tracker>ongoing API method tracker</a> is
     null.<li><p><a id=navigate-event-firing:assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#upcoming-non-traverse-api-method-tracker id=navigate-event-firing:upcoming-non-traverse-api-method-tracker>upcoming non-traverse API method
     tracker</a> is null.<li><p><a id=navigate-event-firing:assert-3 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#upcoming-traverse-api-method-trackers id=navigate-event-firing:upcoming-traverse-api-method-trackers>upcoming traverse API method
     trackers</a> <a href=https://infra.spec.whatwg.org/#list-is-empty id=navigate-event-firing:list-is-empty data-x-internal=list-is-empty>is empty</a>.<li><p>Return true.</ol>

    <p class=note>These assertions holds because <code id=navigate-event-firing:dom-navigation-traverseto><a href=#dom-navigation-traverseto>traverseTo()</a></code>, <code id=navigate-event-firing:dom-navigation-back><a href=#dom-navigation-back>back()</a></code>, and <code id=navigate-event-firing:dom-navigation-forward><a href=#dom-navigation-forward>forward()</a></code> will immediately fail when entries and events
    are disabled (since there are no entries to traverse to), and if our starting point is instead
    <code id=navigate-event-firing:dom-navigation-navigate-2><a href=#dom-navigation-navigate>navigate()</a></code> or <code id=navigate-event-firing:dom-navigation-reload><a href=#dom-navigation-reload>reload()</a></code>, then we <a href=#dont-always-set-upcoming-non-traverse-api-method-tracker>avoided</a> setting the
    <a href=#upcoming-non-traverse-api-method-tracker id=navigate-event-firing:upcoming-non-traverse-api-method-tracker-2>upcoming non-traverse API method tracker</a> in the first place.</p>
   <li><p>Let <var>destinationKey</var> be null.<li><p>If <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-5>entry</a> is non-null, then set
   <var>destinationKey</var> to <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-6>entry</a>'s <a href=#concept-navigationhistoryentry-key id=navigate-event-firing:concept-navigationhistoryentry-key>key</a>.<li><p><a id=navigate-event-firing:assert-4 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>destinationKey</var> is not the empty string.<li><p><a href=#promote-an-upcoming-api-method-tracker-to-ongoing id=navigate-event-firing:promote-an-upcoming-api-method-tracker-to-ongoing>Promote an upcoming API method tracker to ongoing</a> given
   <var>navigation</var> and <var>destinationKey</var>.<li><p>Let <var>apiMethodTracker</var> be <var>navigation</var>'s <a href=#ongoing-api-method-tracker id=navigate-event-firing:ongoing-api-method-tracker-2>ongoing API method
   tracker</a>.<li><p>Let <var>navigable</var> be <var>navigation</var>'s <a id=navigate-event-firing:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#window-navigable id=navigate-event-firing:window-navigable>navigable</a>.<li><p>Let <var>document</var> be <var>navigation</var>'s <a id=navigate-event-firing:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#concept-document-window id=navigate-event-firing:concept-document-window-2>associated <code>Document</code></a>.<li><p>If <var>document</var> <a href=#can-have-its-url-rewritten id=navigate-event-firing:can-have-its-url-rewritten>can have its URL rewritten</a> to <var>destination</var>'s
   <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url-4>URL</a>, and either <var>destination</var>'s
   <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-4>is same document</a> is true or
   <var>navigationType</var> is not "<code id=navigate-event-firing:dom-navigationtype-traverse-2><a href=#dom-navigationtype-traverse>traverse</a></code>",
   then initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-canintercept><a href=#dom-navigateevent-canintercept>canIntercept</a></code> to true. Otherwise, initialize it to
   false.<li id=navigate-event-traverse-can-be-canceled>
    <p>Let <var>traverseCanBeCanceled</var> be true if all of the following are true:</p>

    <ul><li><p><var>navigable</var> is a <a id=navigate-event-firing:top-level-traversable href=document-sequences.html#top-level-traversable>top-level traversable</a>;<li><p><var>destination</var>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-5>is
     same document</a> is true; and<li><p>either <var>userInvolvement</var> is not "<code id=navigate-event-firing:uni-browser-ui><a href=browsing-the-web.html#uni-browser-ui>browser
     UI</a></code>", or <var>navigation</var>'s <a id=navigate-event-firing:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a> has
     <a id=navigate-event-firing:history-action-activation href=interaction.html#history-action-activation>history-action activation</a>.</ul>

    <p>Otherwise, let it be false.</p>
   <li>
    <p>If either:</p>

    <ul><li><p><var>navigationType</var> is not "<code id=navigate-event-firing:dom-navigationtype-traverse-3><a href=#dom-navigationtype-traverse>traverse</a></code>"; or<li><p><var>traverseCanBeCanceled</var> is true,</ul>

    <p>then initialize <var>event</var>'s <code id=navigate-event-firing:dom-event-cancelable><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> to
    true. Otherwise, initialize it to false.</p>
   <li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-event-type><a data-x-internal=dom-event-type href=https://dom.spec.whatwg.org/#dom-event-type>type</a></code> to "<code id=navigate-event-firing:event-navigate-2><a href=indices.html#event-navigate>navigate</a></code>".<li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-navigationtype><a href=#dom-navigateevent-navigationtype>navigationType</a></code> to
   <var>navigationType</var>.<li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-destination><a href=#dom-navigateevent-destination>destination</a></code> to <var>destination</var>.<li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-downloadrequest><a href=#dom-navigateevent-downloadrequest>downloadRequest</a></code> to
   <var>downloadRequestFilename</var>.<li>
    <p>If <var>apiMethodTracker</var> is not null, then initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-info><a href=#dom-navigateevent-info>info</a></code> to <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-info id=navigate-event-firing:navigation-api-method-tracker-info>info</a>. Otherwise, initialize it to
    undefined.</p>

    <p class=note>At this point <var>apiMethodTracker</var>'s <a href=#navigation-api-method-tracker-info id=navigate-event-firing:navigation-api-method-tracker-info-2>info</a> is no longer needed and can be nulled
    out instead of keeping it alive for the lifetime of the <a href=#navigation-api-method-tracker id=navigate-event-firing:navigation-api-method-tracker>navigation API method
    tracker</a>.</p>
   <li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-hasuavisualtransition><a href=#dom-navigateevent-hasuavisualtransition>hasUAVisualTransition</a></code> to true if a visual
   transition, to display a cached rendered state of the <var>document</var>'s <a id=navigate-event-firing:latest-entry href=browsing-the-web.html#latest-entry>latest
   entry</a>, was done by the user agent. Otherwise, initialize it to false.<li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-sourceelement><a href=#dom-navigateevent-sourceelement>sourceElement</a></code> to
   <var>sourceElement</var>.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller>abort
   controller</a> to a <a id=navigate-event-firing:new-4 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:abortcontroller><a data-x-internal=abortcontroller href=https://dom.spec.whatwg.org/#abortcontroller>AbortController</a></code> created in
   <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-7>relevant realm</a>.<li><p>Initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-signal><a href=#dom-navigateevent-signal>signal</a></code> to
   <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller-2>abort
   controller</a>'s <a href=https://dom.spec.whatwg.org/#abortcontroller-signal id=navigate-event-firing:concept-abortcontroller-signal data-x-internal=concept-abortcontroller-signal>signal</a>.<li><p>Let <var>currentURL</var> be <var>document</var>'s <a href=https://dom.spec.whatwg.org/#concept-document-url id="navigate-event-firing:the-document's-address" data-x-internal="the-document's-address">URL</a>.<li>
    <p>If all of the following are true:</p>

    <ul><li><p><var>event</var>'s <a href=#concept-navigateevent-classic-history-api-state id=navigate-event-firing:concept-navigateevent-classic-history-api-state-4>classic history API state</a> is
     null;<li><p><var>destination</var>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-6>is
     same document</a> is true;<li><p><var>destination</var>'s <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url-5>URL</a>
     <a href=https://url.spec.whatwg.org/#concept-url-equals id=navigate-event-firing:concept-url-equals data-x-internal=concept-url-equals>equals</a> <var>currentURL</var> with <a href=https://url.spec.whatwg.org/#url-equals-exclude-fragments id=navigate-event-firing:url-equals-exclude-fragments data-x-internal=url-equals-exclude-fragments><i>exclude fragments</i></a> set to true; and<li><p><var>destination</var>'s <a href=#concept-navigationdestination-url id=navigate-event-firing:concept-navigationdestination-url-6>URL</a>'s
     <a href=https://url.spec.whatwg.org/#concept-url-fragment id=navigate-event-firing:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a> is not <a id=navigate-event-firing:identical-to href=https://infra.spec.whatwg.org/#string-is data-x-internal=identical-to>identical to</a>
     <var>currentURL</var>'s <a href=https://url.spec.whatwg.org/#concept-url-fragment id=navigate-event-firing:concept-url-fragment-2 data-x-internal=concept-url-fragment>fragment</a>,</ul>

    <p>then initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-hashchange><a href=#dom-navigateevent-hashchange>hashChange</a></code> to true. Otherwise, initialize it to
    false.</p>

    <p class=note>The first condition here means that <code id=navigate-event-firing:dom-navigateevent-hashchange-2><a href=#dom-navigateevent-hashchange>hashChange</a></code> will be true for <a href=browsing-the-web.html#navigate-fragid id=navigate-event-firing:navigate-fragid>fragment navigations</a>, but false for cases like <code>history.pushState(undefined, "", "#fragment")</code>.</p>
   <li><p>If <var>userInvolvement</var> is not "<code id=navigate-event-firing:uni-none-3><a href=browsing-the-web.html#uni-none>none</a></code>", then
   initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-userinitiated><a href=#dom-navigateevent-userinitiated>userInitiated</a></code>
   to true. Otherwise, initialize it to false.<li><p>If <var>formDataEntryList</var> is not null, then initialize <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-formdata><a href=#dom-navigateevent-formdata>formData</a></code> to a <a id=navigate-event-firing:new-5 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:formdata><a data-x-internal=formdata href=https://xhr.spec.whatwg.org/#formdata>FormData</a></code>
   created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-8>relevant realm</a>,
   associated to <var>formDataEntryList</var>. Otherwise, initialize it to null.<li><p><a id=navigate-event-firing:assert-5 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event-2>ongoing <code>navigate</code> event</a> is null.<li><p>Set <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event-3>ongoing <code>navigate</code>
   event</a> to <var>event</var>.<li><p>Set <var>navigation</var>'s <a href=#focus-changed-during-ongoing-navigation id=navigate-event-firing:focus-changed-during-ongoing-navigation>focus changed during ongoing navigation</a> to
   false.<li><p>Set <var>navigation</var>'s <a href=#suppress-normal-scroll-restoration-during-ongoing-navigation id=navigate-event-firing:suppress-normal-scroll-restoration-during-ongoing-navigation>suppress normal scroll restoration during ongoing
   navigation</a> to false.<li><p>Let <var>dispatchResult</var> be the result of <a href=https://dom.spec.whatwg.org/#concept-event-dispatch id=navigate-event-firing:concept-event-dispatch data-x-internal=concept-event-dispatch>dispatching</a> <var>event</var> at
   <var>navigation</var>.<li>
    <p>If <var>dispatchResult</var> is false:</p>

    <ol><li><p>If <var>navigationType</var> is "<code id=navigate-event-firing:dom-navigationtype-traverse-4><a href=#dom-navigationtype-traverse>traverse</a></code>", then <a id=navigate-event-firing:consume-history-action-user-activation href=interaction.html#consume-history-action-user-activation>consume history-action user
     activation</a> given <var>navigation</var>'s <a id=navigate-event-firing:concept-relevant-global-5 href=webappapis.html#concept-relevant-global>relevant global object</a>.<li><p>If <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller-3>abort
     controller</a>'s <a href=https://dom.spec.whatwg.org/#abortcontroller-signal id=navigate-event-firing:concept-abortcontroller-signal-2 data-x-internal=concept-abortcontroller-signal>signal</a> is not <a href=https://dom.spec.whatwg.org/#abortsignal-aborted id=navigate-event-firing:abortsignal-aborted data-x-internal=abortsignal-aborted>aborted</a>, then <a href=#abort-the-ongoing-navigation id=navigate-event-firing:abort-the-ongoing-navigation-3>abort the ongoing navigation</a>
     given <var>navigation</var>.<li><p>Return false.</ol>
   <li>
    <p>Let <var>cancel</var> be the following steps given <var>reason</var>:</p>
    <ol><li><p>If <var>event</var>'s <a id=navigate-event-firing:concept-relevant-global-6 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=navigate-event-firing:concept-document-window-3>associated <code>Document</code></a> is not <a id=navigate-event-firing:fully-active href=document-sequences.html#fully-active>fully
     active</a>, then abort these steps.<li><p>If <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller-4>abort
     controller</a>'s <a href=https://dom.spec.whatwg.org/#abortcontroller-signal id=navigate-event-firing:concept-abortcontroller-signal-3 data-x-internal=concept-abortcontroller-signal>signal</a> is <a href=https://dom.spec.whatwg.org/#abortsignal-aborted id=navigate-event-firing:abortsignal-aborted-2 data-x-internal=abortsignal-aborted>aborted</a>, then abort these steps.<li><p><a id=navigate-event-firing:assert-6 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var> equals <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event-4>ongoing <code>navigate</code> event</a>.<li><p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state>interception state</a> is not "<code>intercepted</code>", then <a href=#navigateevent-finish id=navigate-event-firing:navigateevent-finish>finish</a>
     <var>event</var> given false.<li><p><a href=#abort-a-navigateevent id=navigate-event-firing:abort-a-navigateevent>Abort</a> <var>event</var> given
     <var>reason</var>.</p>
    </ol>
   <li>
    <p>Let <var>commit</var> be the following steps:

    <ol><li><p>If <var>event</var>'s <a id=navigate-event-firing:concept-relevant-global-7 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=navigate-event-firing:concept-document-window-4>associated <code>Document</code></a> is not <a id=navigate-event-firing:fully-active-2 href=document-sequences.html#fully-active>fully
     active</a>, then abort these steps.<li><p>If <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller-5>abort
     controller</a>'s <a href=https://dom.spec.whatwg.org/#abortcontroller-signal id=navigate-event-firing:concept-abortcontroller-signal-4 data-x-internal=concept-abortcontroller-signal>signal</a> is <a href=https://dom.spec.whatwg.org/#abortsignal-aborted id=navigate-event-firing:abortsignal-aborted-3 data-x-internal=abortsignal-aborted>aborted</a>, then abort these steps.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state-2>interception state</a> to "<code>committed</code>".<li><p>Let <var>endResultIsSameDocument</var> be true if <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state-3>interception state</a> is not "<code>none</code>" or <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-destination-2><a href=#dom-navigateevent-destination>destination</a></code>'s <a href=#concept-navigationdestination-samedocument id=navigate-event-firing:concept-navigationdestination-samedocument-7>is same document</a> is true.<li>
      <p><a id=navigate-event-firing:prepare-to-run-script href=webappapis.html#prepare-to-run-script>Prepare to run script</a> given <var>navigation</var>'s <a id=navigate-event-firing:relevant-settings-object href=webappapis.html#relevant-settings-object>relevant settings
      object</a>.</p>

      <div id=note-suppress-microtasks-during-navigation-events class=note><a href=#note-suppress-microtasks-during-navigation-events class=self-link></a>
       <p>This is done to avoid the <a id=navigate-event-firing:javascript-execution-context-stack href=https://tc39.es/ecma262/#execution-context-stack data-x-internal=javascript-execution-context-stack>JavaScript execution context stack</a> becoming empty
       right after any <code id=navigate-event-firing:event-currententrychange><a href=indices.html#event-currententrychange>currententrychange</a></code> event
       handlers run as a result of the <a id=navigate-event-firing:url-and-history-update-steps href=browsing-the-web.html#url-and-history-update-steps>URL and history update steps</a> that could soon
       happen. If the stack were to become empty at that time, then it would immediately
       <a id=navigate-event-firing:perform-a-microtask-checkpoint href=webappapis.html#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>, causing various promise fulfillment handlers to
       run interleaved with the event handlers and before any handlers passed to <code id=navigate-event-firing:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code>. This is undesirable
       since it means promise handler ordering vs. <code id=navigate-event-firing:event-currententrychange-2><a href=indices.html#event-currententrychange>currententrychange</a></code> event handler ordering vs. <code id=navigate-event-firing:dom-navigateevent-intercept-2><a href=#dom-navigateevent-intercept>intercept()</a></code> handler ordering would be dependent
       on whether the navigation is happening with an empty <a id=navigate-event-firing:javascript-execution-context-stack-2 href=https://tc39.es/ecma262/#execution-context-stack data-x-internal=javascript-execution-context-stack>JavaScript execution context
       stack</a> (e.g., because the navigation was user-initiated) or with a nonempty one (e.g.,
       because the navigation was caused by a JavaScript API call).</p>

       <p>By inserting an otherwise-unnecessary <a id=navigate-event-firing:javascript-execution-context href=https://tc39.es/ecma262/#sec-execution-contexts data-x-internal=javascript-execution-context>JavaScript execution context</a> onto the
       stack in this step, we essentially suppress the <a id=navigate-event-firing:perform-a-microtask-checkpoint-2 href=webappapis.html#perform-a-microtask-checkpoint>perform a microtask checkpoint</a>
       algorithm until later, thus ensuring that the sequence is always: <code id=navigate-event-firing:event-currententrychange-3><a href=indices.html#event-currententrychange>currententrychange</a></code> event handlers, then <code id=navigate-event-firing:dom-navigateevent-intercept-3><a href=#dom-navigateevent-intercept>intercept()</a></code> handlers, then promise handlers.</p>
      </div>
     <li><p>If <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition>transition</a> is not null, then resolve
     <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-2>transition</a>'s <a href=#concept-navigationtransition-committed id=navigate-event-firing:concept-navigationtransition-committed>committed promise</a> with
     undefined.<li>
      <p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state-4>interception
      state</a> is not "<code>none</code>":</p>
      <ol><li>
        <p>Switch on <var>navigationType</var>:</p>

        <dl class=switch><dt>"<code id=navigate-event-firing:dom-navigationtype-push-2><a href=#dom-navigationtype-push>push</a></code>"<dt>"<code id=navigate-event-firing:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>"<dd><p>Run the <a id=navigate-event-firing:url-and-history-update-steps-2 href=browsing-the-web.html#url-and-history-update-steps>URL and history update steps</a> given <var>document</var> and
         <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-destination-3><a href=#dom-navigateevent-destination>destination</a></code>'s <a href=#dom-navigationdestination-url id=navigate-event-firing:dom-navigationdestination-url>URL</a>, with <i id=navigate-event-firing:uhus-serializeddata><a href=browsing-the-web.html#uhus-serializeddata>serializedData</a></i> set to <var>event</var>'s <a href=#concept-navigateevent-classic-history-api-state id=navigate-event-firing:concept-navigateevent-classic-history-api-state-5>classic history API state</a>
         and <i id=navigate-event-firing:uhus-historyhandling><a href=browsing-the-web.html#uhus-historyhandling>historyHandling</a></i> set to <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-navigationtype-2><a href=#dom-navigateevent-navigationtype>navigationType</a></code>.<dt>"<code id=navigate-event-firing:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>"<dd><p><a href=#update-the-navigation-api-entries-for-a-same-document-navigation id=navigate-event-firing:update-the-navigation-api-entries-for-a-same-document-navigation>Update the navigation API entries for a same-document navigation</a> given
         <var>navigation</var>, <var>navigable</var>'s <a href=document-sequences.html#nav-active-history-entry id=navigate-event-firing:nav-active-history-entry>active session history entry</a>, and "<code id=navigate-event-firing:dom-navigationtype-reload-2><a href=#dom-navigationtype-reload>reload</a></code>".<dt>"<code id=navigate-event-firing:dom-navigationtype-traverse-5><a href=#dom-navigationtype-traverse>traverse</a></code>"<dd>
          <ol><li>
            <p>Set <var>navigation</var>'s <a href=#suppress-normal-scroll-restoration-during-ongoing-navigation id=navigate-event-firing:suppress-normal-scroll-restoration-during-ongoing-navigation-2>suppress normal scroll restoration during ongoing
            navigation</a> to true.</p>

            <p class=note>If <var>event</var>'s <a href=#concept-navigateevent-scroll id=navigate-event-firing:concept-navigateevent-scroll>scroll
            behavior</a> was set to "<code id=navigate-event-firing:dom-navigationscrollbehavior-after-transition><a href=#dom-navigationscrollbehavior-after-transition>after-transition</a></code>", then
            scroll restoration will happen as part of <a href=#navigateevent-finish id=navigate-event-firing:navigateevent-finish-2>finishing</a> the relevant <code id=navigate-event-firing:navigateevent-5><a href=#navigateevent>NavigateEvent</a></code>.
            Otherwise, there will be no scroll restoration. That is, no navigation which is
            intercepted by <code id=navigate-event-firing:dom-navigateevent-intercept-4><a href=#dom-navigateevent-intercept>intercept()</a></code> goes
            through the normal scroll restoration process; scroll restoration for such navigations
            is either done manually, by the web developer, or is done after the transition.</p>
           <li><p>Let <var>userInvolvement</var> be "<code id=navigate-event-firing:uni-none-4><a href=browsing-the-web.html#uni-none>none</a></code>".<li>
            <p>If <var>event</var>'s <code id=navigate-event-firing:dom-navigateevent-userinitiated-2><a href=#dom-navigateevent-userinitiated>userInitiated</a></code> is true, then set
            <var>userInvolvement</var> to "<code id=navigate-event-firing:uni-activation><a href=browsing-the-web.html#uni-activation>activation</a></code>".</p>

            <p class=note>At this point after interception, it is not consequential whether the
            activation was a result of browser UI.</p>
           <li>
            <p><a href=browsing-the-web.html#tn-append-session-history-traversal-steps id=navigate-event-firing:tn-append-session-history-traversal-steps>Append the following session
            history traversal steps</a> to <var>navigable</var>'s <a href=document-sequences.html#nav-traversable id=navigate-event-firing:nav-traversable>traversable navigable</a>:</p>

            <ol><li><p><a id=navigate-event-firing:resume-applying-the-traverse-history-step href=browsing-the-web.html#resume-applying-the-traverse-history-step>Resume applying the traverse history step</a> given
             <var>destination</var>'s <a href=#concept-navigationdestination-entry id=navigate-event-firing:concept-navigationdestination-entry-7>entry</a>'s <a href=#nhe-she id=navigate-event-firing:nhe-she-2>session history entry</a>'s <a href=browsing-the-web.html#she-step id=navigate-event-firing:she-step>step</a>,
             <var>navigable</var>'s <a href=document-sequences.html#nav-traversable id=navigate-event-firing:nav-traversable-2>traversable navigable</a>, and
             <var>userInvolvement</var>.</ol>
           </ol>
         </dl>
       </ol>
     <li>
      <p>If <var>endResultIsSameDocument</var> is true:</p>

      <ol><li><p>Let <var>promisesList</var> be an empty <a id=navigate-event-firing:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li>
        <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigate-event-firing:list-iterate data-x-internal=list-iterate>For each</a> <var>handler</var> of <var>event</var>'s
        <a href=#concept-navigateevent-navigation-handler-list id=navigate-event-firing:concept-navigateevent-navigation-handler-list>navigation handler
        list</a>:</p>

        <ol><li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigate-event-firing:list-append data-x-internal=list-append>Append</a> the result of <a href=https://webidl.spec.whatwg.org/#invoke-a-callback-function id=navigate-event-firing:es-invoking-callback-functions data-x-internal=es-invoking-callback-functions>invoking</a> <var>handler</var> with an empty
         arguments list to <var>promisesList</var>.</ol>
       <li>
        <p>If <var>promisesList</var>'s <a href=https://infra.spec.whatwg.org/#list-size id=navigate-event-firing:list-size data-x-internal=list-size>size</a> is 0, then set
        <var>promisesList</var> to « <a id=navigate-event-firing:a-promise-resolved-with href=https://webidl.spec.whatwg.org/#a-promise-resolved-with data-x-internal=a-promise-resolved-with>a promise resolved with</a> undefined ».</p>

        <p class=note>There is a subtle timing difference between how <a href=https://webidl.spec.whatwg.org/#wait-for-all id=navigate-event-firing:wait-for-all data-x-internal=wait-for-all>waiting for all</a> schedules its success and failure steps when given zero promises
        versus ≥1 promises. For most uses of <a href=https://webidl.spec.whatwg.org/#wait-for-all id=navigate-event-firing:wait-for-all-2 data-x-internal=wait-for-all>waiting for all</a>,
        this does not matter. However, with this API, there are so many events and promise handlers
        which could fire around the same time that the difference is pretty easily observable: it
        can cause the event/promise handler sequence to vary. (Some of the events and promises
        involved include: <code id=navigate-event-firing:event-navigatesuccess><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code> / <code id=navigate-event-firing:event-navigateerror-3><a href=indices.html#event-navigateerror>navigateerror</a></code>, <code id=navigate-event-firing:event-currententrychange-4><a href=indices.html#event-currententrychange>currententrychange</a></code>, <code id=navigate-event-firing:event-dispose><a href=indices.html#event-dispose>dispose</a></code>, <var>apiMethodTracker</var>'s promises, and the <code id=navigate-event-firing:dom-navigationtransition-finished><a href=#dom-navigationtransition-finished>navigation.transition.finished</a></code> promise.)
       <li>
        <p><a id=navigate-event-firing:wait-for-all-3 href=https://webidl.spec.whatwg.org/#wait-for-all data-x-internal=wait-for-all>Wait for all</a> of <var>promisesList</var>, with the following success
        steps:</p>

        <ol><li><p>If <var>event</var>'s <a id=navigate-event-firing:concept-relevant-global-8 href=webappapis.html#concept-relevant-global>relevant global object</a> is not <a id=navigate-event-firing:fully-active-3 href=document-sequences.html#fully-active>fully
         active</a>, then abort these steps.<li><p>If <var>event</var>'s <a href=#concept-navigateevent-abort-controller id=navigate-event-firing:concept-navigateevent-abort-controller-6>abort
         controller</a>'s <a href=https://dom.spec.whatwg.org/#abortcontroller-signal id=navigate-event-firing:concept-abortcontroller-signal-5 data-x-internal=concept-abortcontroller-signal>signal</a> is <a href=https://dom.spec.whatwg.org/#abortsignal-aborted id=navigate-event-firing:abortsignal-aborted-4 data-x-internal=abortsignal-aborted>aborted</a>, then abort these steps.<li><p><a id=navigate-event-firing:assert-7 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var> equals <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event-5>ongoing
         <code>navigate</code> event</a>.<li><p>Set <var>navigation</var>'s <a href=#ongoing-navigate-event id=navigate-event-firing:ongoing-navigate-event-6>ongoing <code>navigate</code> event</a> to null.<li><p><a href=#navigateevent-finish id=navigate-event-firing:navigateevent-finish-3>Finish</a> <var>event</var> given
         true.<li><p>If <var>apiMethodTracker</var> is non-null, then <a href=#resolve-the-finished-promise id=navigate-event-firing:resolve-the-finished-promise>resolve the finished
         promise</a> for <var>apiMethodTracker</var>.<li><p><a href=https://dom.spec.whatwg.org/#concept-event-fire id=navigate-event-firing:concept-event-fire data-x-internal=concept-event-fire>Fire an event</a> named <code id=navigate-event-firing:event-navigatesuccess-2><a href=indices.html#event-navigatesuccess>navigatesuccess</a></code> at <var>navigation</var>.<li><p>If <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-3>transition</a> is not null, then resolve
         <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-4>transition</a>'s
         <a href=#concept-navigationtransition-finished id=navigate-event-firing:concept-navigationtransition-finished>finished promise</a> with
         undefined.<li><p>Set <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-5>transition</a> to null.</ol>

        <p>and <var>cancel</var> as failure step.
       </ol>
     <li><p>Otherwise, if <var>apiMethodTracker</var> is non-null, then <a href=#navigation-api-method-tracker-clean-up id=navigate-event-firing:navigation-api-method-tracker-clean-up>clean up</a>
     <var>apiMethodTracker</var>.<li>
      <p><a id=navigate-event-firing:clean-up-after-running-script href=webappapis.html#clean-up-after-running-script>Clean up after running script</a> given <var>navigation</var>'s <a id=navigate-event-firing:relevant-settings-object-2 href=webappapis.html#relevant-settings-object>relevant
      settings object</a>.</p>

      <p class=note>Per the <a href=#note-suppress-microtasks-during-navigation-events>previous
      note</a>, this stops suppressing any potential promise handler microtasks, causing them to run
      at this point or later.</p>
     </ol>
   <li>
    <p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state-5>interception
    state</a> is not "<code>none</code>":</p>

    <ol><li><p>Let <var>fromNHE</var> be the <a href=#navigation-current-entry id=navigate-event-firing:navigation-current-entry>current
     entry</a> of <var>navigation</var>.<li><p><a id=navigate-event-firing:assert-8 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>fromNHE</var> is not null.<li>
      <p>Set <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-6>transition</a>
      to a <a id=navigate-event-firing:new-6 href=https://webidl.spec.whatwg.org/#new data-x-internal=new>new</a> <code id=navigate-event-firing:navigationtransition><a href=#navigationtransition>NavigationTransition</a></code> created in <var>navigation</var>'s
      <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-9>relevant realm</a>, with

      <dl class=props><dt><a href=#concept-navigationtransition-navigationtype id=navigate-event-firing:concept-navigationtransition-navigationtype>navigation type</a><dd><var>navigationType</var><dt><a href=#concept-navigationtransition-from id=navigate-event-firing:concept-navigationtransition-from>from entry</a><dd><var>fromNHE</var><dt><a href=#concept-navigationtransition-committed id=navigate-event-firing:concept-navigationtransition-committed-2>committed promise</a><dd>a new promise created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-10>relevant realm</a><dt><a href=#concept-navigationtransition-finished id=navigate-event-firing:concept-navigationtransition-finished-2>finished promise</a><dd>a new promise created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-11>relevant realm</a></dl>
     <li>
      <p><a id=navigate-event-firing:mark-as-handled href=https://webidl.spec.whatwg.org/#mark-a-promise-as-handled data-x-internal=mark-as-handled>Mark as handled</a> <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-7>transition</a>'s <a href=#concept-navigationtransition-finished id=navigate-event-firing:concept-navigationtransition-finished-3>finished promise</a>.</p>

      <p class=note>See the <a href=#note-mark-as-handled-navigation-api-finished>discussion
      about other finished promises</a> to understand why this is done.</p>
     <li><p><a id=navigate-event-firing:mark-as-handled-2 href=https://webidl.spec.whatwg.org/#mark-a-promise-as-handled data-x-internal=mark-as-handled>Mark as handled</a> <var>navigation</var>'s <a href=#concept-navigation-transition id=navigate-event-firing:concept-navigation-transition-8>transition</a>'s <a href=#concept-navigationtransition-committed id=navigate-event-firing:concept-navigationtransition-committed-3>committed promise</a>.</ol>
   <li><p>If <var>event</var>'s <a href=#concept-navigateevent-navigation-precommit-handler-list id=navigate-event-firing:concept-navigateevent-navigation-precommit-handler-list>navigation precommit handler
   list</a> <a href=https://infra.spec.whatwg.org/#list-is-empty id=navigate-event-firing:list-is-empty-2 data-x-internal=list-is-empty>is empty</a> then run <var>commit</var>.<li>
    <p>Otherwise:</p>

    <ol><li><p>Let <var>precommitController</var> be a new <code id=navigate-event-firing:navigationprecommitcontroller><a href=#navigationprecommitcontroller>NavigationPrecommitController</a></code>
     created in <var>navigation</var>'s <a href=webappapis.html#concept-relevant-realm id=navigate-event-firing:concept-relevant-realm-12>relevant realm</a>,
     whose <a href=#concept-navigationprecommitcontroller-event id=navigate-event-firing:concept-navigationprecommitcontroller-event>event</a> is
     <var>event</var>.<li><p>Let <var>precommitPromisesList</var> be an empty <a id=navigate-event-firing:list-2 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li>
      <p><a href=https://infra.spec.whatwg.org/#list-iterate id=navigate-event-firing:list-iterate-2 data-x-internal=list-iterate>For each</a> <var>handler</var> of <var>event</var>'s <a href=#concept-navigateevent-navigation-precommit-handler-list id=navigate-event-firing:concept-navigateevent-navigation-precommit-handler-list-2>navigation precommit handler
      list</a>:</p>

      <ol><li><p><a href=https://infra.spec.whatwg.org/#list-append id=navigate-event-firing:list-append-2 data-x-internal=list-append>Append</a> the result of <a href=https://webidl.spec.whatwg.org/#invoke-a-callback-function id=navigate-event-firing:es-invoking-callback-functions-2 data-x-internal=es-invoking-callback-functions>invoking</a> <var>handler</var> with
       « <var>precommitController</var> » to <var>precommitPromisesList</var>.</ol>
     <li><p><a id=navigate-event-firing:wait-for-all-4 href=https://webidl.spec.whatwg.org/#wait-for-all data-x-internal=wait-for-all>Wait for all</a> <var>precommitPromisesList</var> with success steps set to
     <var>commit</var>, and failure steps set to <var>cancel</var>.</ol>
   <li><p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-firing:concept-navigateevent-interception-state-6>interception
   state</a> is "<code>none</code>", then return true.<li><p>Return false.</ol>


  <h6 id=navigate-event-scroll-focus><span class=secno>7.2.6.10.5</span> Scroll and focus behavior<a href=#navigate-event-scroll-focus class=self-link></a></h6>

  <p>By calling <code id=navigate-event-scroll-focus:dom-navigateevent-intercept><a href=#dom-navigateevent-intercept>navigateEvent.intercept()</a></code>, web
  developers can suppress the normal scroll and focus behavior for same-document navigations,
  instead invoking cross-document navigation-like behavior at a later time. The algorithms in this
  section are called at those appropriate later points.</p>

  <p>To <dfn id=navigateevent-finish>finish</dfn> a <code id=navigate-event-scroll-focus:navigateevent><a href=#navigateevent>NavigateEvent</a></code>
  <var>event</var>, given a boolean <var>didFulfill</var>:</p>

  <ol><li><p><a id=navigate-event-scroll-focus:assert href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state>interception state</a> is not "<code>finished</code>".<li>
    <p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-2>interception
    state</a> is "<code>intercepted</code>", then:</p>

    <ol><li><p>Assert: <var>didFulfill</var> is false.<li>
      <p>Assert: <var>event</var>'s <a href=#concept-navigateevent-navigation-precommit-handler-list id=navigate-event-scroll-focus:concept-navigateevent-navigation-precommit-handler-list>navigation precommit handler
      list</a> <a href=https://infra.spec.whatwg.org/#list-is-empty id=navigate-event-scroll-focus:list-is-empty data-x-internal=list-is-empty>is not empty</a>.</p>

      <p class=note>Only precommit handlers can cancel a navigation before it is committed.</p>
     <li><p>Set <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-3>interception state</a> to "<code>finished</code>".<li><p>Return.</ol>

   <li><p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-4>interception
   state</a> is "<code>none</code>", then return.<li><p><a href=#potentially-reset-the-focus id=navigate-event-scroll-focus:potentially-reset-the-focus>Potentially reset the focus</a> given <var>event</var>.<li><p>If <var>didFulfill</var> is true, then <a href=#potentially-process-scroll-behavior id=navigate-event-scroll-focus:potentially-process-scroll-behavior>potentially process scroll behavior</a>
   given <var>event</var>.<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-5>interception state</a> to "<code>finished</code>".</ol>

  <p>To <dfn id=potentially-reset-the-focus>potentially reset the focus</dfn> given a <code id=navigate-event-scroll-focus:navigateevent-2><a href=#navigateevent>NavigateEvent</a></code>
  <var>event</var>:</p>

  <ol><li><p><a id=navigate-event-scroll-focus:assert-2 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-6>interception state</a> is "<code>committed</code>" or "<code>scrolled</code>".<li><p>Let <var>navigation</var> be <var>event</var>'s <a id=navigate-event-scroll-focus:concept-relevant-global href=webappapis.html#concept-relevant-global>relevant global object</a>'s
   <a href=#window-navigation-api id=navigate-event-scroll-focus:window-navigation-api>navigation API</a>.<li><p>Let <var>focusChanged</var> be <var>navigation</var>'s <a href=#focus-changed-during-ongoing-navigation id=navigate-event-scroll-focus:focus-changed-during-ongoing-navigation>focus changed during ongoing
   navigation</a>.<li><p>Set <var>navigation</var>'s <a href=#focus-changed-during-ongoing-navigation id=navigate-event-scroll-focus:focus-changed-during-ongoing-navigation-2>focus changed during ongoing navigation</a> to
   false.<li><p>If <var>focusChanged</var> is true, then return.<li>
    <p>If <var>event</var>'s <a href=#concept-navigateevent-focusreset id=navigate-event-scroll-focus:concept-navigateevent-focusreset>focus reset
    behavior</a> is "<code id=navigate-event-scroll-focus:dom-navigationfocusreset-manual><a href=#dom-navigationfocusreset-manual>manual</a></code>", then
    return.</p>

    <p class=note>If it was left as null, then we treat that as "<code id=navigate-event-scroll-focus:dom-navigationfocusreset-after-transition><a href=#dom-navigationfocusreset-after-transition>after-transition</a></code>", and continue
    onward.</p>
   <li><p>Let <var>document</var> be <var>event</var>'s <a id=navigate-event-scroll-focus:concept-relevant-global-2 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#concept-document-window id=navigate-event-scroll-focus:concept-document-window>associated <code>Document</code></a>.<li><p>Let <var>focusTarget</var> be the <a id=navigate-event-scroll-focus:autofocus-delegate href=interaction.html#autofocus-delegate>autofocus delegate</a> for
   <var>document</var>.<li><p>If <var>focusTarget</var> is null, then set <var>focusTarget</var> to
   <var>document</var>'s <a href=dom.html#the-body-element-2 id=navigate-event-scroll-focus:the-body-element-2>body element</a>.<li><p>If <var>focusTarget</var> is null, then set <var>focusTarget</var> to
   <var>document</var>'s <a id=navigate-event-scroll-focus:document-element href=https://dom.spec.whatwg.org/#document-element data-x-internal=document-element>document element</a>.<li><p>Run the <a id=navigate-event-scroll-focus:focusing-steps href=interaction.html#focusing-steps>focusing steps</a> for <var>focusTarget</var>, with <var>document</var>'s
   <a id=navigate-event-scroll-focus:viewport href=https://drafts.csswg.org/css2/#viewport data-x-internal=viewport>viewport</a> as the <var>fallback target</var>.<li><p>Move the <a id=navigate-event-scroll-focus:sequential-focus-navigation-starting-point href=interaction.html#sequential-focus-navigation-starting-point>sequential focus navigation starting point</a> to
   <var>focusTarget</var>.</ol>

  <p>To <dfn id=potentially-process-scroll-behavior>potentially process scroll behavior</dfn> given a <code id=navigate-event-scroll-focus:navigateevent-3><a href=#navigateevent>NavigateEvent</a></code>
  <var>event</var>:</p>

  <ol><li><p><a id=navigate-event-scroll-focus:assert-3 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-7>interception state</a> is "<code>committed</code>" or "<code>scrolled</code>".<li><p>If <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-8>interception
   state</a> is "<code>scrolled</code>", then return.<li>
    <p>If <var>event</var>'s <a href=#concept-navigateevent-scroll id=navigate-event-scroll-focus:concept-navigateevent-scroll>scroll behavior</a> is
    "<code id=navigate-event-scroll-focus:dom-navigationscrollbehavior-manual><a href=#dom-navigationscrollbehavior-manual>manual</a></code>", then return.</p>

    <p class=note>If it was left as null, then we treat that as "<code id=navigate-event-scroll-focus:dom-navigationscrollbehavior-after-transition><a href=#dom-navigationscrollbehavior-after-transition>after-transition</a></code>", and continue
    onward.</p>
   <li><p><a href=#process-scroll-behavior id=navigate-event-scroll-focus:process-scroll-behavior>Process scroll behavior</a> given <var>event</var>.</p>
  </ol>

  <p>To <dfn id=process-scroll-behavior>process scroll behavior</dfn> given a <code id=navigate-event-scroll-focus:navigateevent-4><a href=#navigateevent>NavigateEvent</a></code> <var>event</var>:</p>

  <ol><li><p><a id=navigate-event-scroll-focus:assert-4 href=https://infra.spec.whatwg.org/#assert data-x-internal=assert>Assert</a>: <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-9>interception state</a> is "<code>committed</code>".<li><p>Set <var>event</var>'s <a href=#concept-navigateevent-interception-state id=navigate-event-scroll-focus:concept-navigateevent-interception-state-10>interception state</a> to "<code>scrolled</code>".<li><p>If <var>event</var>'s <code id=navigate-event-scroll-focus:dom-navigateevent-navigationtype><a href=#dom-navigateevent-navigationtype>navigationType</a></code> was initialized to "<code id=navigate-event-scroll-focus:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>" or "<code id=navigate-event-scroll-focus:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", then <a id=navigate-event-scroll-focus:restore-scroll-position-data href=browsing-the-web.html#restore-scroll-position-data>restore scroll position data</a>
   given <var>event</var>'s <a id=navigate-event-scroll-focus:concept-relevant-global-3 href=webappapis.html#concept-relevant-global>relevant global object</a>'s <a href=#window-navigable id=navigate-event-scroll-focus:window-navigable>navigable</a>'s <a href=document-sequences.html#nav-active-history-entry id=navigate-event-scroll-focus:nav-active-history-entry>active session history
   entry</a>.<li>
    <p>Otherwise:</p>

    <ol><li><p>Let <var>document</var> be <var>event</var>'s <a id=navigate-event-scroll-focus:concept-relevant-global-4 href=webappapis.html#concept-relevant-global>relevant global object</a>'s
     <a href=#concept-document-window id=navigate-event-scroll-focus:concept-document-window-2>associated <code>Document</code></a>.<li><p>If <var>document</var>'s <a id=navigate-event-scroll-focus:the-indicated-part-of-the-document href=browsing-the-web.html#the-indicated-part-of-the-document>indicated part</a> is null, then <a id=navigate-event-scroll-focus:scroll-to-the-beginning-of-the-document href=https://drafts.csswg.org/cssom-view/#scroll-to-the-beginning-of-the-document data-x-internal=scroll-to-the-beginning-of-the-document>scroll to the
     beginning of the document</a> given <var>document</var>. <a href=references.html#refsCSSOMVIEW>[CSSOMVIEW]</a><li><p>Otherwise, <a id=navigate-event-scroll-focus:scroll-to-the-fragment-identifier href=browsing-the-web.html#scroll-to-the-fragment-identifier>scroll to the fragment</a> given <var>document</var>.</ol>
   </ol>

  

  <h4 id=nav-traversal-event-interfaces><span class=secno>7.2.7</span> Event interfaces<a href=#nav-traversal-event-interfaces class=self-link></a></h4>

  <p class=note>The <code id=nav-traversal-event-interfaces:navigateevent><a href=#navigateevent>NavigateEvent</a></code> interface has <a href=#the-navigate-event>its own
  dedicated section</a>, due to its complexity.</p>


  <h5 id=the-navigationcurrententrychangeevent-interface><span class=secno>7.2.7.1</span> The <code id=the-navigationcurrententrychangeevent-interface:navigationcurrententrychangeevent><a href=#navigationcurrententrychangeevent>NavigationCurrentEntryChangeEvent</a></code> interface<a href=#the-navigationcurrententrychangeevent-interface class=self-link></a></h5>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='navigationcurrententrychangeevent' data-dfn-type='interface'><c- g>NavigationCurrentEntryChangeEvent</c-></dfn> : <a id='the-navigationcurrententrychangeevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <a href='#navigationcurrententrychangeeventinit' id='the-navigationcurrententrychangeevent-interface:navigationcurrententrychangeeventinit'><c- n>NavigationCurrentEntryChangeEventInit</c-></a> <c- g>eventInitDict</c->);

  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationtype' id='the-navigationcurrententrychangeevent-interface:navigationtype'><c- n>NavigationType</c-></a>? <a href='#dom-navigationcurrententrychangeevent-navigationtype' id='the-navigationcurrententrychangeevent-interface:dom-navigationcurrententrychangeevent-navigationtype'><c- g>navigationType</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a href='#navigationhistoryentry' id='the-navigationcurrententrychangeevent-interface:navigationhistoryentry'><c- n>NavigationHistoryEntry</c-></a> <a href='#dom-navigationcurrententrychangeevent-from' id='the-navigationcurrententrychangeevent-interface:dom-navigationcurrententrychangeevent-from'><c- g>from</c-></a>;
};

<c- b>dictionary</c-> <dfn id='navigationcurrententrychangeeventinit' data-dfn-type='dictionary'><c- g>NavigationCurrentEntryChangeEventInit</c-></dfn> : <a id='the-navigationcurrententrychangeevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <a href='#navigationtype' id='the-navigationcurrententrychangeevent-interface:navigationtype-2'><c- n>NavigationType</c-></a>? <dfn data-dfn-for='NavigationCurrentEntryChangeEventInit' id='dom-navigationcurrententrychangeeventinit-navigationtype' data-dfn-type='dict-member'><c- g>navigationType</c-></dfn> = <c- b>null</c->;
  <c- b>required</c-> <a href='#navigationhistoryentry' id='the-navigationcurrententrychangeevent-interface:navigationhistoryentry-2'><c- n>NavigationHistoryEntry</c-></a> <dfn data-dfn-for='NavigationCurrentEntryChangeEventInit' id='dom-navigationcurrententrychangeeventinit-from' data-dfn-type='dict-member'><c- g>from</c-></dfn>;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-navigationcurrententrychangeevent-navigationtype id=dom-navigationcurrententrychangeevent-navigationtype-dev>navigationType</a></code><dd><p>Returns the type of navigation which caused the current entry to change, or null if the
   change is due to <code id=the-navigationcurrententrychangeevent-interface:dom-navigation-updatecurrententry><a href=#dom-navigation-updatecurrententry>navigation.updateCurrentEntry()</a></code>.<dt><code><var>event</var>.<a href=#dom-navigationcurrententrychangeevent-from id=dom-navigationcurrententrychangeevent-from-dev>from</a></code><dd>
    <p>Returns the previous value of <code id=the-navigationcurrententrychangeevent-interface:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code>, before the current entry
    changed.</p>

    <p>If <code id=the-navigationcurrententrychangeevent-interface:dom-navigationcurrententrychangeevent-navigationtype-2><a href=#dom-navigationcurrententrychangeevent-navigationtype>navigationType</a></code>
    is null or "<code id=the-navigationcurrententrychangeevent-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", then this value will be the
    same as <code id=the-navigationcurrententrychangeevent-interface:dom-navigation-currententry-2><a href=#dom-navigation-currententry>navigation.currentEntry</a></code>. In that case,
    the event signifies that the contents of the entry changed, even if we did not move to a new
    entry or replace the current one.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=NavigationCurrentEntryChangeEvent id=dom-navigationcurrententrychangeevent-navigationtype data-dfn-type=attribute><code>navigationType</code></dfn> and <dfn data-dfn-for=NavigationCurrentEntryChangeEvent id=dom-navigationcurrententrychangeevent-from data-dfn-type=attribute><code>from</code></dfn> attributes must return the
  values they were initialized to.</p>

  


  <h5 id=the-popstateevent-interface><span class=secno>7.2.7.2</span> The <code id=the-popstateevent-interface:popstateevent><a href=#popstateevent>PopStateEvent</a></code> interface<a href=#the-popstateevent-interface class=self-link></a></h5><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent/PopStateEvent title="The PopStateEvent() constructor creates a new PopStateEvent object.">PopStateEvent/PopStateEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>11+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>16+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>14+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent title="PopStateEvent is an interface for the popstate event.">PopStateEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='popstateevent' data-dfn-type='interface'><c- g>PopStateEvent</c-></dfn> : <a id='the-popstateevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <c- b>optional</c-> <a href='#popstateeventinit' id='the-popstateevent-interface:popstateeventinit'><c- n>PopStateEventInit</c-></a> <c- g>eventInitDict</c-> = {});

  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>any</c-> <a href='#dom-popstateevent-state' id='the-popstateevent-interface:dom-popstateevent-state'><c- g>state</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-popstateevent-hasuavisualtransition' id='the-popstateevent-interface:dom-popstateevent-hasuavisualtransition'><c- g>hasUAVisualTransition</c-></a>;
};

<c- b>dictionary</c-> <dfn id='popstateeventinit' data-dfn-type='dictionary'><c- g>PopStateEventInit</c-></dfn> : <a id='the-popstateevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <c- b>any</c-> <dfn data-dfn-for='PopStateEventInit' id='dom-popstateeventinit-state' data-dfn-type='dict-member'><c- g>state</c-></dfn> = <c- b>null</c->;
  <c- b>boolean</c-> <dfn data-dfn-for='PopStateEventInit' id='dom-popstateeventinit-hasuavisualtransition' data-dfn-type='dict-member'><c- g>hasUAVisualTransition</c-></dfn> = <c- b>false</c->;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-popstateevent-state id=dom-popstateevent-state-dev>state</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent/state title="The state read-only property of the PopStateEvent interface represents the state stored when the event was created.">PopStateEvent/state</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>4+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>10+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd><p>Returns a copy of the information that was provided to <code id=the-popstateevent-interface:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code> or <code id=the-popstateevent-interface:dom-history-replacestate><a href=#dom-history-replacestate>replaceState()</a></code>.<dt><code><var>event</var>.<a href=#dom-popstateevent-hasuavisualtransition id=dom-popstateevent-hasuavisualtransition-dev>hasUAVisualTransition</a></code><dd><p>Returns true if the user agent performed a visual transition for this navigation before
   dispatching this event. If true, the best user experience will be given if the author
   synchronously updates the DOM to the post-navigation state.</dl>

  

  <p>The <dfn data-dfn-for=PopStateEvent id=dom-popstateevent-state data-dfn-type=attribute><code>state</code></dfn> attribute must return the value it was
  initialized to. It represents the context information for the event, or null, if the state
  represented is the initial state of the <code id=the-popstateevent-interface:document><a href=dom.html#document>Document</a></code>.</p>

  <p>The <dfn data-dfn-for=PopStateEvent id=dom-popstateevent-hasuavisualtransition data-dfn-type=attribute><code>
  hasUAVisualTransition</code></dfn> attribute must return the value it was initialized to.</p>

  


  <h5 id=the-hashchangeevent-interface><span class=secno>7.2.7.3</span> The <code id=the-hashchangeevent-interface:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code> interface<a href=#the-hashchangeevent-interface class=self-link></a></h5><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent/HashChangeEvent title="The HashChangeEvent() constructor creates a new HashChangeEvent object, that is used by the hashchange event fired at the window object when the fragment of the URL changes.">HashChangeEvent/HashChangeEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>11+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>16+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent title="The HashChangeEvent interface represents events that fire when the fragment identifier of the URL has changed.">HashChangeEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>3.6+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>8+</span></span><hr><span class="opera yes"><span>Opera</span><span>10.6+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>8+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>5+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>11+</span></span></div></div></div>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='hashchangeevent' data-dfn-type='interface'><c- g>HashChangeEvent</c-></dfn> : <a id='the-hashchangeevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <c- b>optional</c-> <a href='#hashchangeeventinit' id='the-hashchangeevent-interface:hashchangeeventinit'><c- n>HashChangeEventInit</c-></a> <c- g>eventInitDict</c-> = {});

  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-hashchangeevent-oldurl' id='the-hashchangeevent-interface:dom-hashchangeevent-oldurl'><c- g>oldURL</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c-> <a href='#dom-hashchangeevent-newurl' id='the-hashchangeevent-interface:dom-hashchangeevent-newurl'><c- g>newURL</c-></a>;
};

<c- b>dictionary</c-> <dfn id='hashchangeeventinit' data-dfn-type='dictionary'><c- g>HashChangeEventInit</c-></dfn> : <a id='the-hashchangeevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <c- b>USVString</c-> <c- g>oldURL</c-> = &quot;&quot;;
  <c- b>USVString</c-> <c- g>newURL</c-> = &quot;&quot;;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-hashchangeevent-oldurl id=dom-hashchangeevent-oldurl-dev>oldURL</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent/oldURL title="The oldURL read-only property of the HashChangeEvent interface returns the previous URL from which the window was navigated.">HashChangeEvent/oldURL</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>6+</span></span><span class="safari yes"><span>Safari</span><span>5.1+</span></span><span class="chrome yes"><span>Chrome</span><span>8+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <a id=the-hashchangeevent-interface:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> of the <a id=the-hashchangeevent-interface:session-history-entry href=browsing-the-web.html#session-history-entry>session history entry</a> that was previously
    current.</p>
   <dt><code><var>event</var>.<a href=#dom-hashchangeevent-newurl id=dom-hashchangeevent-newurl-dev>newURL</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent/newURL title="The newURL read-only property of the HashChangeEvent interface returns the new URL to which the window is navigating.">HashChangeEvent/newURL</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>6+</span></span><span class="safari yes"><span>Safari</span><span>5.1+</span></span><span class="chrome yes"><span>Chrome</span><span>8+</span></span><hr><span class="opera yes"><span>Opera</span><span>12.1+</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Android</span><span>12.1+</span></span></div></div></div><dd>
    <p>Returns the <a id=the-hashchangeevent-interface:url-2 href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> of the <a id=the-hashchangeevent-interface:session-history-entry-2 href=browsing-the-web.html#session-history-entry>session history entry</a> that is now
    current.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=HashChangeEvent id=dom-hashchangeevent-oldurl data-dfn-type=attribute><code>oldURL</code></dfn> attribute must return the value it was
  initialized to. It represents context information for the event, specifically the URL of the
  <a id=the-hashchangeevent-interface:session-history-entry-3 href=browsing-the-web.html#session-history-entry>session history entry</a> that was traversed from.</p>

  <p>The <dfn data-dfn-for=HashChangeEvent id=dom-hashchangeevent-newurl data-dfn-type=attribute><code>newURL</code></dfn> attribute must return the value it was
  initialized to. It represents context information for the event, specifically the URL of the
  <a id=the-hashchangeevent-interface:session-history-entry-4 href=browsing-the-web.html#session-history-entry>session history entry</a> that was traversed to.</p>

  


  <h5 id=the-pageswapevent-interface><span class=secno>7.2.7.4</span> The <code id=the-pageswapevent-interface:pageswapevent><a href=#pageswapevent>PageSwapEvent</a></code> interface<a href=#the-pageswapevent-interface class=self-link></a></h5>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='pageswapevent' data-dfn-type='interface'><c- g>PageSwapEvent</c-></dfn> : <a id='the-pageswapevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <c- b>optional</c-> <a href='#pageswapeventinit' id='the-pageswapevent-interface:pageswapeventinit'><c- n>PageSwapEventInit</c-></a> <c- g>eventInitDict</c-> = {});
  <c- b>readonly</c-> <c- b>attribute</c-> <code id='the-pageswapevent-interface:navigationactivation'><a href='#navigationactivation'><c- n>NavigationActivation</c-></a></code>? <a href='#dom-pageswapevent-activation' id='the-pageswapevent-interface:dom-pageswapevent-activation'><c- g>activation</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <code id='the-pageswapevent-interface:viewtransition'><a data-x-internal='viewtransition' href='https://drafts.csswg.org/css-view-transitions/#viewtransition'><c- n>ViewTransition</c-></a></code>? <a href='#dom-pageswapevent-viewtransition' id='the-pageswapevent-interface:dom-pageswapevent-viewtransition'><c- g>viewTransition</c-></a>;
};

<c- b>dictionary</c-> <dfn id='pageswapeventinit' data-dfn-type='dictionary'><c- g>PageSwapEventInit</c-></dfn> : <a id='the-pageswapevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <a href='#navigationactivation' id='the-pageswapevent-interface:navigationactivation-2'><c- n>NavigationActivation</c-></a>? <dfn data-dfn-for='PageSwapEventInit' id='dom-pageswapeventinit-activation' data-dfn-type='dict-member'><c- g>activation</c-></dfn> = <c- b>null</c->;
  <code id='the-pageswapevent-interface:viewtransition-2'><a data-x-internal='viewtransition' href='https://drafts.csswg.org/css-view-transitions/#viewtransition'><c- n>ViewTransition</c-></a></code>? <dfn data-dfn-for='PageSwapEventInit' id='dom-pageswapeventinit-viewtransition' data-dfn-type='dict-member'><c- g>viewTransition</c-></dfn> = <c- b>null</c->;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-pageswapevent-activation id=dom-pageswapevent-activation-dev>activation</a></code><dd><p>A <code id=the-pageswapevent-interface:navigationactivation-3><a href=#navigationactivation>NavigationActivation</a></code> object representing the destination and type of the
   cross-document navigation. This would be null for cross-origin navigations.<dt><code><var>event</var>.<a href=#dom-pageswapevent-activation id=the-pageswapevent-interface:dom-pageswapevent-activation-2>activation</a>.<a href=#dom-navigationactivation-entry id=the-pageswapevent-interface:dom-navigationactivation-entry>entry</a></code><dd><p>A <code id=the-pageswapevent-interface:navigationhistoryentry><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, representing the <code id=the-pageswapevent-interface:document><a href=dom.html#document>Document</a></code> that is
   about to become active.<dt><code><var>event</var>.<a href=#dom-pageswapevent-activation id=the-pageswapevent-interface:dom-pageswapevent-activation-3>activation</a>.<a href=#dom-navigationactivation-from id=the-pageswapevent-interface:dom-navigationactivation-from>from</a></code><dd><p>A <code id=the-pageswapevent-interface:navigationhistoryentry-2><a href=#navigationhistoryentry>NavigationHistoryEntry</a></code>, equivalent to the value of the <code id=the-pageswapevent-interface:dom-navigation-currententry><a href=#dom-navigation-currententry>navigation.currentEntry</a></code> property at the moment the
   event is fired.<dt><code><var>event</var>.<a href=#dom-pageswapevent-activation id=the-pageswapevent-interface:dom-pageswapevent-activation-4>activation</a>.<a href=#dom-navigationactivation-navigationtype id=the-pageswapevent-interface:dom-navigationactivation-navigationtype>navigationType</a></code><dd><p>One of "<code id=the-pageswapevent-interface:dom-navigationtype-push><a href=#dom-navigationtype-push>push</a></code>", "<code id=the-pageswapevent-interface:dom-navigationtype-replace><a href=#dom-navigationtype-replace>replace</a></code>", "<code id=the-pageswapevent-interface:dom-navigationtype-reload><a href=#dom-navigationtype-reload>reload</a></code>", or "<code id=the-pageswapevent-interface:dom-navigationtype-traverse><a href=#dom-navigationtype-traverse>traverse</a></code>", indicating what type of navigation
   that is about to result in a page swap.<dt><code><var>event</var>.<a href=#dom-pageswapevent-viewtransition id=dom-pageswapevent-viewtransition-dev>viewTransition</a></code><dd>
    <p>Returns the <code id=the-pageswapevent-interface:viewtransition-3><a data-x-internal=viewtransition href=https://drafts.csswg.org/css-view-transitions/#viewtransition>ViewTransition</a></code> object that represents an outbound cross-document view
    transition, if such transition is active when the event is fired. Otherwise, returns null.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=PageSwapEvent id=dom-pageswapevent-activation data-dfn-type=attribute><code>activation</code></dfn> and <dfn data-dfn-for=PageSwapEvent id=dom-pageswapevent-viewtransition data-dfn-type=attribute><code>viewTransition</code></dfn> attributes must return
  the values they were initialized to.</p>

  


  <h5 id=the-pagerevealevent-interface><span class=secno>7.2.7.5</span> The <code id=the-pagerevealevent-interface:pagerevealevent><a href=#pagerevealevent>PageRevealEvent</a></code> interface<a href=#the-pagerevealevent-interface class=self-link></a></h5>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='pagerevealevent' data-dfn-type='interface'><c- g>PageRevealEvent</c-></dfn> : <a id='the-pagerevealevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <c- b>optional</c-> <a href='#pagerevealeventinit' id='the-pagerevealevent-interface:pagerevealeventinit'><c- n>PageRevealEventInit</c-></a> <c- g>eventInitDict</c-> = {});
  <c- b>readonly</c-> <c- b>attribute</c-> <code id='the-pagerevealevent-interface:viewtransition'><a data-x-internal='viewtransition' href='https://drafts.csswg.org/css-view-transitions/#viewtransition'><c- n>ViewTransition</c-></a></code>? <a href='#dom-pagerevealevent-viewtransition' id='the-pagerevealevent-interface:dom-pagerevealevent-viewtransition'><c- g>viewTransition</c-></a>;
};

<c- b>dictionary</c-> <dfn id='pagerevealeventinit' data-dfn-type='dictionary'><c- g>PageRevealEventInit</c-></dfn> : <a id='the-pagerevealevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <code id='the-pagerevealevent-interface:viewtransition-2'><a data-x-internal='viewtransition' href='https://drafts.csswg.org/css-view-transitions/#viewtransition'><c- n>ViewTransition</c-></a></code>? <dfn data-dfn-for='PageRevealEventInit' id='dom-pagerevealeventinit-viewtransition' data-dfn-type='dict-member'><c- g>viewTransition</c-></dfn> = <c- b>null</c->;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-pagerevealevent-viewtransition id=dom-pagerevealevent-viewtransition-dev>viewTransition</a></code><dd>
    <p>Returns the <code id=the-pagerevealevent-interface:viewtransition-3><a data-x-internal=viewtransition href=https://drafts.csswg.org/css-view-transitions/#viewtransition>ViewTransition</a></code> object that represents an inbound cross-document view
    transition, if such transition is active when the event is fired. Otherwise, returns null.</p>
   </dl>

  

  <p>The <dfn data-dfn-for=PageRevealEvent id=dom-pagerevealevent-viewtransition data-dfn-type=attribute><code>viewTransition</code></dfn> attribute must return the
  value it was initialized to.</p>

  


  <h5 id=the-pagetransitionevent-interface><span class=secno>7.2.7.6</span> The <code id=the-pagetransitionevent-interface:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface<a href=#the-pagetransitionevent-interface class=self-link></a></h5><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent/PageTransitionEvent title="The PageTransitionEvent() constructor creates a new PageTransitionEvent object, that is used by the pageshow or pagehide events, fired at the window object when a page is loaded or unloaded.">PageTransitionEvent/PageTransitionEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>11+</span></span><span class="safari yes"><span>Safari</span><span>6+</span></span><span class="chrome yes"><span>Chrome</span><span>16+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge unknown"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>Internet Explorer</span><span>No</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android unknown"><span>WebView Android</span><span>?</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent title="The PageTransitionEvent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.">PageTransitionEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1.5+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>11</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>4+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='pagetransitionevent' data-dfn-type='interface'><c- g>PageTransitionEvent</c-></dfn> : <a id='the-pagetransitionevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- g>constructor</c->(<c- b>DOMString</c-> <c- g>type</c->, <c- b>optional</c-> <a href='#pagetransitioneventinit' id='the-pagetransitionevent-interface:pagetransitioneventinit'><c- n>PageTransitionEventInit</c-></a> <c- g>eventInitDict</c-> = {});

  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>boolean</c-> <a href='#dom-pagetransitionevent-persisted' id='the-pagetransitionevent-interface:dom-pagetransitionevent-persisted'><c- g>persisted</c-></a>;
};

<c- b>dictionary</c-> <dfn id='pagetransitioneventinit' data-dfn-type='dictionary'><c- g>PageTransitionEventInit</c-></dfn> : <a id='the-pagetransitionevent-interface:eventinit' href='https://dom.spec.whatwg.org/#dictdef-eventinit' data-x-internal='eventinit'><c- n>EventInit</c-></a> {
  <c- b>boolean</c-> <c- g>persisted</c-> = <c- b>false</c->;
};</code></pre>

  <dl class=domintro><dt><code><var>event</var>.<a href=#dom-pagetransitionevent-persisted id=dom-pagetransitionevent-persisted-dev>persisted</a></code><div class="mdn-anno wrapped before"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent/persisted title="The persisted read-only property indicates if a webpage is loading from a cache.">PageTransitionEvent/persisted</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>11+</span></span><span class="safari yes"><span>Safari</span><span>5+</span></span><span class="chrome yes"><span>Chrome</span><span>4+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge yes"><span>Edge (Legacy)</span><span>12+</span></span><span class="ie yes"><span>Internet Explorer</span><span>11</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios yes"><span>Safari iOS</span><span>4+</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android unknown"><span>Samsung Internet</span><span>?</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div><dd>
    <p>For the <code id=the-pagetransitionevent-interface:event-pageshow><a href=indices.html#event-pageshow>pageshow</a></code> event, returns false if the page is
    newly being loaded (and the <code id=the-pagetransitionevent-interface:event-load><a href=indices.html#event-load>load</a></code> event will fire). Otherwise,
    returns true.</p>

    <p>For the <code id=the-pagetransitionevent-interface:event-pagehide><a href=indices.html#event-pagehide>pagehide</a></code> event, returns false if the page is
    going away for the last time. Otherwise, returns true, meaning that the page might be reused if
    the user navigates back to this page (if the <code id=the-pagetransitionevent-interface:document><a href=dom.html#document>Document</a></code>'s <i id=the-pagetransitionevent-interface:concept-document-salvageable><a href=document-lifecycle.html#concept-document-salvageable>salvageable</a></i> state stays true). </p>

    <p>Things that can cause the page to be unsalvageable include:</p>

    <ul><li><p>The user agent decided to not keep the <code id=the-pagetransitionevent-interface:document-2><a href=dom.html#document>Document</a></code> alive in a <a id=the-pagetransitionevent-interface:session-history-entry href=browsing-the-web.html#session-history-entry>session
     history entry</a> after <a href=document-lifecycle.html#unload-a-document id=the-pagetransitionevent-interface:unload-a-document>unload</a><li><p>Having <code id=the-pagetransitionevent-interface:the-iframe-element><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>s that are not <i id=the-pagetransitionevent-interface:concept-document-salvageable-2><a href=document-lifecycle.html#concept-document-salvageable>salvageable</a></i><li><p>Active <code id=the-pagetransitionevent-interface:websocket-2><a data-x-internal=websocket-2 href=https://websockets.spec.whatwg.org/#websocket>WebSocket</a></code> objects<li><p><a href=document-lifecycle.html#abort-a-document id=the-pagetransitionevent-interface:abort-a-document>Aborting a <code>Document</code></a></ul>
   </dl>

  

  <p>The <dfn data-dfn-for=PageTransitionEvent id=dom-pagetransitionevent-persisted data-dfn-type=attribute><code>persisted</code></dfn> attribute must return the value
  it was initialized to. It represents the context information for the event.</p>

  <p>To <dfn id=fire-a-page-transition-event>fire a page transition event</dfn> named <var>eventName</var> at a <code id=the-pagetransitionevent-interface:window><a href=#window>Window</a></code>
  <var>window</var> with a boolean <var>persisted</var>, <a href=https://dom.spec.whatwg.org/#concept-event-fire id=the-pagetransitionevent-interface:concept-event-fire data-x-internal=concept-event-fire>fire
  an event</a> named <var>eventName</var> at <var>window</var>, using
  <code id=the-pagetransitionevent-interface:pagetransitionevent-2><a href=#pagetransitionevent>PageTransitionEvent</a></code>, with the <code id=the-pagetransitionevent-interface:dom-pagetransitionevent-persisted-2><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized to
  <var>persisted</var>, the <code id=the-pagetransitionevent-interface:dom-event-cancelable><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> attribute
  initialized to true, the <code id=the-pagetransitionevent-interface:dom-event-bubbles><a data-x-internal=dom-event-bubbles href=https://dom.spec.whatwg.org/#dom-event-bubbles>bubbles</a></code> attribute initialized to
  true, and <i>legacy target override flag</i> set.</p>

  <p class=note>The values for <code id=the-pagetransitionevent-interface:dom-event-cancelable-2><a data-x-internal=dom-event-cancelable href=https://dom.spec.whatwg.org/#dom-event-cancelable>cancelable</a></code> and <code id=the-pagetransitionevent-interface:dom-event-bubbles-2><a data-x-internal=dom-event-bubbles href=https://dom.spec.whatwg.org/#dom-event-bubbles>bubbles</a></code> don't make any sense, since canceling the event does
  nothing and it's not possible to bubble past the <code id=the-pagetransitionevent-interface:window-2><a href=#window>Window</a></code> object. They are set to true
  for historical reasons.</p>

  


  <h5 id=the-beforeunloadevent-interface><span class=secno>7.2.7.7</span> The <code id=the-beforeunloadevent-interface:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> interface<a href=#the-beforeunloadevent-interface class=self-link></a></h5><div class="mdn-anno wrapped"><button onclick=toggleStatus(this) class=mdn-anno-btn><b title="Support in all current engines." class=all-engines-flag>✔</b><span>MDN</span></button><div class=feature><p><a href=https://developer.mozilla.org/en-US/docs/Web/API/BeforeUnloadEvent title="BeforeUnloadEvent is an interface for the beforeunload event.">BeforeUnloadEvent</a><p class=all-engines-text>Support in all current engines.<div class=support><span class="firefox yes"><span>Firefox</span><span>1.5+</span></span><span class="safari yes"><span>Safari</span><span>7+</span></span><span class="chrome yes"><span>Chrome</span><span>30+</span></span><hr><span class="opera unknown"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span><hr><span class="edge unknown"><span>Edge (Legacy)</span><span>?</span></span><span class="ie yes"><span>Internet Explorer</span><span>4+</span></span><hr><span class="firefox_android unknown"><span>Firefox Android</span><span>?</span></span><span class="safari_ios unknown"><span>Safari iOS</span><span>?</span></span><span class="chrome_android unknown"><span>Chrome Android</span><span>?</span></span><span class="webview_android yes"><span>WebView Android</span><span>37+</span></span><span class="samsunginternet_android yes"><span>Samsung Internet</span><span>3.0+</span></span><span class="opera_android unknown"><span>Opera Android</span><span>?</span></span></div></div></div>

  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='beforeunloadevent' data-dfn-type='interface'><c- g>BeforeUnloadEvent</c-></dfn> : <a id='the-beforeunloadevent-interface:event' href='https://dom.spec.whatwg.org/#interface-event' data-x-internal='event'><c- n>Event</c-></a> {
  <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-beforeunloadevent-returnvalue' id='the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue'><c- g>returnValue</c-></a>;
};</code></pre>

  <p class=note>There are no <code id=the-beforeunloadevent-interface:beforeunloadevent-2><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>-specific initialization methods.</p>

  <p>The <code id=the-beforeunloadevent-interface:beforeunloadevent-3><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> interface is a legacy interface which allows <a id=the-beforeunloadevent-interface:checking-if-unloading-is-canceled href=browsing-the-web.html#checking-if-unloading-is-canceled>checking
  if unloading is canceled</a> to be controlled not only by canceling the event, but by setting
  the <code id=the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue-2><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute to a value
  besides the empty string. Authors should use the <code id=the-beforeunloadevent-interface:dom-event-preventdefault><a data-x-internal=dom-event-preventdefault href=https://dom.spec.whatwg.org/#dom-event-preventdefault>preventDefault()</a></code> method, or other means of canceling
  events, instead of using <code id=the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue-3><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>.</p>

  

  <p>The <dfn data-dfn-for=BeforeUnloadEvent id=dom-beforeunloadevent-returnvalue data-dfn-type=attribute><code>returnValue</code></dfn> attribute controls the process
  of <a id=the-beforeunloadevent-interface:checking-if-unloading-is-canceled-2 href=browsing-the-web.html#checking-if-unloading-is-canceled>checking if unloading is canceled</a>. When the event is created, the
  attribute must be set to the empty string. On getting, it must return the last value it was set
  to. On setting, the attribute must be set to the new value.</p>

  <p class=note>This attribute is a <code>DOMString</code> only for historical reasons.
  Any value besides the empty string will be treated as a request to ask the user for
  confirmation.</p>

  

  <h4 id=the-notrestoredreasons-interface><span class=secno>7.2.8</span> The <code id=the-notrestoredreasons-interface:notrestoredreasons><a href=#notrestoredreasons>NotRestoredReasons</a></code> interface<a href=#the-notrestoredreasons-interface class=self-link></a></h4>
  <pre><code class='idl'>[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='notrestoredreasondetails' data-dfn-type='interface'><c- g>NotRestoredReasonDetails</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c-> <a href='#dom-not-restored-reason-details-reason' id='the-notrestoredreasons-interface:dom-not-restored-reason-details-reason'><c- g>reason</c-></a>;
  [<c- g>Default</c->] <c- b>object</c-> <c- g>toJSON</c->();
};

[<c- g>Exposed</c->=<c- n>Window</c->]
<c- b>interface</c-> <dfn id='notrestoredreasons' data-dfn-type='interface'><c- g>NotRestoredReasons</c-></dfn> {
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c->? <a href='#dom-not-restored-reasons-src' id='the-notrestoredreasons-interface:dom-not-restored-reasons-src'><c- g>src</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c->? <a href='#dom-not-restored-reasons-id' id='the-notrestoredreasons-interface:dom-not-restored-reasons-id'><c- g>id</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>DOMString</c->? <a href='#dom-not-restored-reasons-name' id='the-notrestoredreasons-interface:dom-not-restored-reasons-name'><c- g>name</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>USVString</c->? <a href='#dom-not-restored-reasons-url' id='the-notrestoredreasons-interface:dom-not-restored-reasons-url'><c- g>url</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a href='#notrestoredreasondetails' id='the-notrestoredreasons-interface:notrestoredreasondetails'><c- n>NotRestoredReasonDetails</c-></a>&gt;? <a href='#dom-not-restored-reasons-reasons' id='the-notrestoredreasons-interface:dom-not-restored-reasons-reasons'><c- g>reasons</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <c- b>FrozenArray</c->&lt;<a href='#notrestoredreasons' id='the-notrestoredreasons-interface:notrestoredreasons-2'><c- n>NotRestoredReasons</c-></a>&gt;? <a href='#dom-not-restored-reasons-children' id='the-notrestoredreasons-interface:dom-not-restored-reasons-children'><c- g>children</c-></a>;
  [<c- g>Default</c->] <c- b>object</c-> <c- g>toJSON</c->();
};</code></pre>

  <dl class=domintro><dt><code><var>notRestoredReasonDetails</var>.<a href=#dom-not-restored-reason-details-reason id=dom-not-restored-reason-details-reason-dev>reason</a></code><dd><p>Returns a string that explains the reason that prevented the document from <a href=browsing-the-web.html#note-bfcache>being served from back/forward cache</a>. See the definition of <a href=dom.html#concept-document-bfcache-blocking-details id=the-notrestoredreasons-interface:concept-document-bfcache-blocking-details>bfcache blocking details</a> for the
   possible string values.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-src id=dom-not-restored-reasons-src-dev>src</a></code><dd><p>Returns the <code id=the-notrestoredreasons-interface:attr-iframe-src><a href=iframe-embed-object.html#attr-iframe-src>src</a></code> attribute of the document's <a id=the-notrestoredreasons-interface:node-navigable href=document-sequences.html#node-navigable>node
   navigable</a>'s <a href=document-sequences.html#nav-container id=the-notrestoredreasons-interface:nav-container>container</a> if it is an <code id=the-notrestoredreasons-interface:the-iframe-element><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>
   element. This can be null if not set or if it is not an <code id=the-notrestoredreasons-interface:the-iframe-element-2><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code> element.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-id id=dom-not-restored-reasons-id-dev>id</a></code><dd><p>Returns the <code id=the-notrestoredreasons-interface:the-id-attribute><a href=dom.html#the-id-attribute>id</a></code> attribute of the document's <a id=the-notrestoredreasons-interface:node-navigable-2 href=document-sequences.html#node-navigable>node
   navigable</a>'s <a href=document-sequences.html#nav-container id=the-notrestoredreasons-interface:nav-container-2>container</a> if it is an <code id=the-notrestoredreasons-interface:the-iframe-element-3><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>
   element. This can be null if not set or if it is not an <code id=the-notrestoredreasons-interface:the-iframe-element-4><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code> element.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-name id=dom-not-restored-reasons-name-dev>name</a></code><dd><p>Returns the <code id=the-notrestoredreasons-interface:attr-iframe-name><a href=iframe-embed-object.html#attr-iframe-name>name</a></code> attribute of the document's
   <a id=the-notrestoredreasons-interface:node-navigable-3 href=document-sequences.html#node-navigable>node navigable</a>'s <a href=document-sequences.html#nav-container id=the-notrestoredreasons-interface:nav-container-3>container</a> if it is an
   <code id=the-notrestoredreasons-interface:the-iframe-element-5><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code> element. This can be null if not set or if it is not an <code id=the-notrestoredreasons-interface:the-iframe-element-6><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>
   element.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-url id=dom-not-restored-reasons-url-dev>url</a></code><dd><p>Returns the document's <a href=https://dom.spec.whatwg.org/#concept-document-url id="the-notrestoredreasons-interface:the-document's-address" data-x-internal="the-document's-address">URL</a>, or null if the
   document is in a cross-origin <code id=the-notrestoredreasons-interface:the-iframe-element-7><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>. This is reported in addition to <code id=the-notrestoredreasons-interface:dom-not-restored-reasons-src-2><a href=#dom-not-restored-reasons-src>src</a></code> because it is possible <code id=the-notrestoredreasons-interface:the-iframe-element-8><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>
   navigated since the original <code id=the-notrestoredreasons-interface:attr-iframe-src-2><a href=iframe-embed-object.html#attr-iframe-src>src</a></code> was set.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-reasons id=dom-not-restored-reasons-reasons-dev>reasons</a></code><dd><p>Returns an array of <code id=the-notrestoredreasons-interface:notrestoredreasondetails-2><a href=#notrestoredreasondetails>NotRestoredReasonDetails</a></code> for the document. This is null
   if the document is in a cross-origin <code id=the-notrestoredreasons-interface:the-iframe-element-9><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>.<dt><code><var>notRestoredReasons</var>.<a href=#dom-not-restored-reasons-children id=dom-not-restored-reasons-children-dev>children</a></code><dd><p>Returns an array of <code id=the-notrestoredreasons-interface:notrestoredreasons-3><a href=#notrestoredreasons>NotRestoredReasons</a></code> that are for the document’s
   children. This is null if the document is in a cross-origin <code id=the-notrestoredreasons-interface:the-iframe-element-10><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>.</dl>

  <p>A <code id=the-notrestoredreasons-interface:notrestoredreasondetails-3><a href=#notrestoredreasondetails>NotRestoredReasonDetails</a></code> object has a <dfn id=concept-not-restored-reason-details-backing-struct>backing struct</dfn>, a <a href=#nrr-details-struct id=the-notrestoredreasons-interface:nrr-details-struct>not restored reason details</a> or null, initially null.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasonDetails id=dom-not-restored-reason-details-reason data-dfn-type=attribute><code>reason</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reason-details-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reason-details-backing-struct>backing struct</a>'s <a href=#nrr-details-reason id=the-notrestoredreasons-interface:nrr-details-reason>reason</a>.</p>

  <p>To <dfn id=create-a-notrestoredreasondetails-object>create a <code>NotRestoredReasonDetails</code> object</dfn> given a <a href=#nrr-details-struct id=the-notrestoredreasons-interface:nrr-details-struct-2>not restored reason details</a> <var>backingStruct</var> and a
  <a id=the-notrestoredreasons-interface:realm href=https://tc39.es/ecma262/#sec-code-realms data-x-internal=realm>realm</a> <var>realm</var>:</p>

  <ol><li><p>Let <var>notRestoredReasonDetails</var> be a new <code id=the-notrestoredreasons-interface:notrestoredreasondetails-4><a href=#notrestoredreasondetails>NotRestoredReasonDetails</a></code>
   object created in <var>realm</var>.<li><p>Set <var>notRestoredReasonDetails</var>'s <a href=#concept-not-restored-reason-details-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reason-details-backing-struct-2>backing struct</a> to
   <var>backingStruct</var>.<li><p>Return <var>notRestoredReasonDetails</var>.</ol>

  <p>A <dfn id=nrr-details-struct data-export="">not restored reason details</dfn> is a
  <a id=the-notrestoredreasons-interface:struct href=https://infra.spec.whatwg.org/#struct data-x-internal=struct>struct</a> with the following <a href=https://infra.spec.whatwg.org/#struct-item id=the-notrestoredreasons-interface:struct-item data-x-internal=struct-item>items</a>:</p>

  <ul><li><p><dfn id=nrr-details-reason>reason</dfn>, a string, initially empty.</ul>

  <p>The <a href=#nrr-details-reason id=the-notrestoredreasons-interface:nrr-details-reason-2>reason</a> is a string that represents the reason that
  prevented the page from being restored from <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.
  The string is one of the following:</p>

  <dl><dt>"<dfn id=blocking-fetch><code>fetch</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document>unloading</a>, a fetch initiated by this
   <code id=the-notrestoredreasons-interface:document><a href=dom.html#document>Document</a></code> was still ongoing and was canceled, so the page was not in a state that
   could be stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.<dt>"<dfn id=blocking-navigation-failure><code>navigation-failure</code></dfn>"<dd>The original navigation that created this <code id=the-notrestoredreasons-interface:document-2><a href=dom.html#document>Document</a></code> errored, so storing the
   resulting error document in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a> was
   prevented.<dt>"<dfn id=blocking-parser-aborted><code>parser-aborted</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-3><a href=dom.html#document>Document</a></code> never finished its initial HTML parsing, so storing the unfinished
   document in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a> was prevented.<dt>"<dfn id=blocking-websocket><code>websocket</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-2>unloading</a>, an open <code id=the-notrestoredreasons-interface:websocket-2><a data-x-internal=websocket-2 href=https://websockets.spec.whatwg.org/#websocket>WebSocket</a></code>
   connection was shut down, so the page was not in a state that could be stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsWEBSOCKETS>[WEBSOCKETS]</a><dt>"<dfn id=blocking-weblock data-export=""><code>lock</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-3>unloading</a>, held <a id=the-notrestoredreasons-interface:locks href=https://w3c.github.io/web-locks/#lock-concept data-x-internal=locks>locks</a> and
   <a id=the-notrestoredreasons-interface:lock-requests href=https://w3c.github.io/web-locks/#lock-request data-x-internal=lock-requests>lock requests</a> were terminated, so the page was not in a state that could be stored
   in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsWEBLOCKS>[WEBLOCKS]</a><dt>"<dfn id=blocking-masked data-export=""><code>masked</code></dfn>"<dd>This <code id=the-notrestoredreasons-interface:document-4><a href=dom.html#document>Document</a></code> has children that are in a cross-origin <code id=the-notrestoredreasons-interface:the-iframe-element-11><a href=iframe-embed-object.html#the-iframe-element>iframe</a></code>, and
   they prevented <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>; or this <code id=the-notrestoredreasons-interface:document-5><a href=dom.html#document>Document</a></code>
   could not be <a href=browsing-the-web.html#note-bfcache>back/forward cached</a> for user agent-specific reasons, and
   the user agent has chosen not to use one of the more specific reasons from the list of <a href=#ua-specific-blocking-reasons id=the-notrestoredreasons-interface:ua-specific-blocking-reasons>user-agent specific blocking reasons</a>.
  </dl>

  <p>In addition to the list above, a user agent might choose to expose a reason that prevented the
  page from being restored from <a href=note-bfcache.html>back/forward cache</a> for <dfn id=ua-specific-blocking-reasons>user-agent specific blocking reasons</dfn>. These are one of
  the following strings:</p>

  <dl><dt>"<dfn id=blocking-audio-capture data-export=""><code>audio-capture</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-6><a href=dom.html#document>Document</a></code> requested audio capture permission by using <cite>Media Capture and
   Streams</cite>'s <code id=the-notrestoredreasons-interface:getusermedia()><a data-x-internal=getusermedia() href=https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia>getUserMedia()</a></code> with audio. <a href=references.html#refsMEDIASTREAM>[MEDIASTREAM]</a><dt>"<dfn id=blocking-background-work data-export=""><code>background-work</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-7><a href=dom.html#document>Document</a></code> requested background work by calling <code id=the-notrestoredreasons-interface:syncmanager><a data-x-internal=syncmanager href=https://wicg.github.io/background-sync/spec/#syncmanager>SyncManager</a></code>'s
   <code id=the-notrestoredreasons-interface:dom-syncmanager-register><a data-x-internal=dom-syncmanager-register href=https://wicg.github.io/background-sync/spec/#dom-syncmanager-register>register()</a></code> method,
   <code id=the-notrestoredreasons-interface:periodicsyncmanager><a data-x-internal=periodicsyncmanager href=https://wicg.github.io/periodic-background-sync/#periodicsyncmanager>PeriodicSyncManager</a></code>'s <code id=the-notrestoredreasons-interface:dom-periodicsyncmanager-register><a data-x-internal=dom-periodicsyncmanager-register href=https://wicg.github.io/periodic-background-sync/#dom-periodicsyncmanager-register>register()</a></code> method, or
   <code id=the-notrestoredreasons-interface:backgroundfetchmanager><a data-x-internal=backgroundfetchmanager href=https://wicg.github.io/background-fetch/#backgroundfetchmanager>BackgroundFetchManager</a></code>'s <code id=the-notrestoredreasons-interface:dom-backgroundfetchmanager-fetch><a data-x-internal=dom-backgroundfetchmanager-fetch href=https://wicg.github.io/background-fetch/#dom-backgroundfetchmanager-fetch>fetch()</a></code> method.<dt>"<dfn id=blocking-broadcastchannel-message data-export=""><code>broadcastchannel-message</code></dfn>"<dd>While the page was stored in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>, a
   <code id=the-notrestoredreasons-interface:broadcastchannel><a href=web-messaging.html#broadcastchannel>BroadcastChannel</a></code> connection on the page received a message and <code id=the-notrestoredreasons-interface:event-message><a href=indices.html#event-message>message</a></code> event was fired.<dt>"<dfn id=blocking-idb-event data-export=""><code>idbversionchangeevent</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-8><a href=dom.html#document>Document</a></code> had a pending <code id=the-notrestoredreasons-interface:idbversionchangeevent><a data-x-internal=idbversionchangeevent href=https://w3c.github.io/IndexedDB/#idbversionchangeevent>IDBVersionChangeEvent</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-4>unloading</a>. <a href=references.html#refsINDEXEDDB>[INDEXEDDB]</a><dt>"<dfn id=blocking-idledetector data-export=""><code>idledetector</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-9><a href=dom.html#document>Document</a></code> had an active <code id=the-notrestoredreasons-interface:idledetector><a data-x-internal=idledetector href=https://wicg.github.io/idle-detection/#idledetector>IdleDetector</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-5>unloading</a>.<dt>"<dfn id=blocking-keyboard-lock data-export=""><code>keyboardlock</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-6>unloading</a>, keyboard lock was still active
   because <code id=the-notrestoredreasons-interface:keyboard><a data-x-internal=keyboard href=https://wicg.github.io/keyboard-lock/#keyboard>Keyboard</a></code>'s <code id=the-notrestoredreasons-interface:dom-keyboard-lock><a data-x-internal=dom-keyboard-lock href=https://wicg.github.io/keyboard-lock/#dom-keyboard-lock>lock()</a></code> method was
   called.<dt>"<dfn id=blocking-mediastream data-export=""><code>mediastream</code></dfn>"<dd>A <code id=the-notrestoredreasons-interface:mediastreamtrack><a data-x-internal=mediastreamtrack href=https://w3c.github.io/mediacapture-main/getusermedia.html#mediastreamtrack>MediaStreamTrack</a></code> was in the <a id=the-notrestoredreasons-interface:live-state href=https://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStreamTrackState.live data-x-internal=live-state>live state</a> upon <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-7>unloading</a>. <a href=references.html#refsMEDIASTREAM>[MEDIASTREAM]</a><dt>"<dfn id=blocking-midi data-export=""><code>midi</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-10><a href=dom.html#document>Document</a></code> requested a MIDI permission by calling <code id=the-notrestoredreasons-interface:dom-navigator-requestmidiaccess><a data-x-internal=dom-navigator-requestmidiaccess href=https://webaudio.github.io/web-midi-api/#dom-navigator-requestmidiaccess>navigator.requestMIDIAccess()</a></code>.<dt>"<dfn id=blocking-modals data-export=""><code>modals</code></dfn>"<dd><a href=timers-and-user-prompts.html#user-prompts>User prompts</a> were shown while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-8>
   unloading</a>.<dt>"<dfn id=blocking-navigating data-export=""><code>navigating</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-9>unloading</a>, loading was still ongoing, and so
   the <code id=the-notrestoredreasons-interface:document-11><a href=dom.html#document>Document</a></code> was not in a state that could be stored in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.<dt>"<dfn id=blocking-navigation-canceled data-export=""><code>navigation-canceled</code></dfn>"<dd>The navigation request was canceled by calling <code id=the-notrestoredreasons-interface:dom-window-stop><a href=#dom-window-stop>window.stop()</a></code> and the page was not in a state to be stored in <a href=note-bfcache.html>back/forward cache</a>.<dt>"<dfn id=blocking-non-trivial-bcg data-export=""><code>non-trivial-browsing-context-group</code></dfn>"<dd>The <a id=the-notrestoredreasons-interface:browsing-context-group href=document-sequences.html#browsing-context-group>browsing context group</a> of this <code id=the-notrestoredreasons-interface:document-12><a href=dom.html#document>Document</a></code> had more than one
   <a id=the-notrestoredreasons-interface:top-level-browsing-context href=document-sequences.html#top-level-browsing-context>top-level browsing context</a>.<dt>"<dfn id=blocking-otp data-export=""><code>otpcredential</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-13><a href=dom.html#document>Document</a></code> created an <code id=the-notrestoredreasons-interface:otpcredential><a data-x-internal=otpcredential href=https://wicg.github.io/web-otp/#otpcredential>OTPCredential</a></code>.<dt>"<dfn id=blocking-outstanding-network-request data-export=""><code>outstanding-network-request</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-10>unloading</a>, the <code id=the-notrestoredreasons-interface:document-14><a href=dom.html#document>Document</a></code> had
   outstanding network requests and was not in a state that could be stored in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.<dt>"<dfn id=blocking-payment data-export=""><code>paymentrequest</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-15><a href=dom.html#document>Document</a></code> had an active <code id=the-notrestoredreasons-interface:paymentrequest><a data-x-internal=paymentrequest href=https://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-11>unloading</a>. <a href=references.html#refsPAYMENTREQUEST>[PAYMENTREQUEST]</a><dt>"<dfn id=blocking-picture-in-picture data-export=""><code>pictureinpicturewindow</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-16><a href=dom.html#document>Document</a></code> had an active <code id=the-notrestoredreasons-interface:pictureinpicturewindow><a data-x-internal=pictureinpicturewindow href=https://w3c.github.io/picture-in-picture/#pictureinpicturewindow>PictureInPictureWindow</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-12>unloading</a>. <a href=references.html#refsPICTUREINPICTURE>[PICTUREINPICTURE]</a><dt>"<dfn id=blocking-plugins data-export=""><code>plugins</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-17><a href=dom.html#document>Document</a></code> contained <a href=infrastructure.html#plugin id=the-notrestoredreasons-interface:plugin>plugins</a>.<dt>"<dfn id=blocking-method-not-get data-export=""><code>request-method-not-get</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-18><a href=dom.html#document>Document</a></code> was created from an HTTP request whose <a href=https://fetch.spec.whatwg.org/#concept-request-method id=the-notrestoredreasons-interface:concept-request-method data-x-internal=concept-request-method>method</a> was not `<code>GET</code>`.
   <a href=references.html#refsFETCH>[FETCH]</a><dt>"<dfn id=blocking-auth-required data-export=""><code>response-auth-required</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-19><a href=dom.html#document>Document</a></code> was created from an HTTP response that required HTTP
   authentication.<dt>"<dfn id=blocking-ccns data-export=""><code>response-cache-control-no-store</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-20><a href=dom.html#document>Document</a></code> was created from an HTTP response whose `<code id=the-notrestoredreasons-interface:http-cache-control><a data-x-internal=http-cache-control href=https://httpwg.org/specs/rfc7234.html#header.cache-control>Cache-Control</a></code>` header included the "<code>no-store</code>" token. <a href=references.html#refsHTTP>[HTTP]</a><dt>"<dfn id=blocking-ccnc data-export=""><code>response-cache-control-no-cache</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-21><a href=dom.html#document>Document</a></code> was created from an HTTP response whose `<code id=the-notrestoredreasons-interface:http-cache-control-2><a data-x-internal=http-cache-control href=https://httpwg.org/specs/rfc7234.html#header.cache-control>Cache-Control</a></code>` header included the "<code>no-cache</code>" token. <a href=references.html#refsHTTP>[HTTP]</a><dt>"<dfn id=blocking-keepalive data-export=""><code>response-keep-alive</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-22><a href=dom.html#document>Document</a></code> was created from an HTTP response that contained a `<code>Keep-Alive</code>` header.<dt>"<dfn id=blocking-not-http-https data-export=""><code>response-scheme-not-http-or-https</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-23><a href=dom.html#document>Document</a></code> was created from a response whose <a href=https://fetch.spec.whatwg.org/#concept-response-url id=the-notrestoredreasons-interface:concept-response-url data-x-internal=concept-response-url>URL</a>'s <a href=https://url.spec.whatwg.org/#concept-url-scheme id=the-notrestoredreasons-interface:concept-url-scheme data-x-internal=concept-url-scheme>scheme</a> was
   not an <a id=the-notrestoredreasons-interface:http(s)-scheme href=https://fetch.spec.whatwg.org/#http-scheme data-x-internal=http(s)-scheme>HTTP(S) scheme</a>. <a href=references.html#refsFETCH>[FETCH]</a><dt>"<dfn id=blocking-response-not-ok data-export=""><code>response-status-not-ok</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-24><a href=dom.html#document>Document</a></code> was created from an HTTP response whose <a href=https://fetch.spec.whatwg.org/#concept-response-status id=the-notrestoredreasons-interface:concept-response-status data-x-internal=concept-response-status>status</a> was not an <a id=the-notrestoredreasons-interface:ok-status href=https://fetch.spec.whatwg.org/#ok-status data-x-internal=ok-status>ok status</a>.
   <a href=references.html#refsFETCH>[FETCH]</a><dt>"<dfn id=blocking-rtc data-export=""><code>rtc</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-13>unloading</a>, a <code id=the-notrestoredreasons-interface:rtcpeerconnection><a data-x-internal=rtcpeerconnection href=https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection>RTCPeerConnection</a></code> or
   <code id=the-notrestoredreasons-interface:rtcdatachannel><a data-x-internal=rtcdatachannel href=https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel>RTCDataChannel</a></code> was shut down, so the page was not in a state that could be stored in
   the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsWEBRTC>[WEBRTC]</a><dt>"<dfn id=blocking-rtc-used-with-ccns data-export=""><code>rtc-used-with-cache-control-no-store</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-25><a href=dom.html#document>Document</a></code> was created from an HTTP response whose
   `<code id=the-notrestoredreasons-interface:http-cache-control-3><a data-x-internal=http-cache-control href=https://httpwg.org/specs/rfc7234.html#header.cache-control>Cache-Control</a></code>` header included the
   "<code>no-store</code>" token, and it has created a <code id=the-notrestoredreasons-interface:rtcpeerconnection-2><a data-x-internal=rtcpeerconnection href=https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection>RTCPeerConnection</a></code> or
   <code id=the-notrestoredreasons-interface:rtcdatachannel-2><a data-x-internal=rtcdatachannel href=https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel>RTCDataChannel</a></code> which might be used to receive sensitive information, so the page was
   not in a state that could be stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.
   <a href=references.html#refsHTTP>[HTTP]</a> <a href=references.html#refsWEBRTC>[WEBRTC]</a><dt>"<dfn id=blocking-sensors data-export=""><code>sensors</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-26><a href=dom.html#document>Document</a></code> <a href=https://w3c.github.io/sensors/#request-sensor-access id=the-notrestoredreasons-interface:request-sensor-access data-x-internal=request-sensor-access>requested sensor
   access</a>.<dt>"<dfn id=sw-added data-export=""><code>serviceworker-added</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-27><a href=dom.html#document>Document</a></code>'s <a href=https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client id=the-notrestoredreasons-interface:serviceworkercontainer-service-worker-client data-x-internal=serviceworkercontainer-service-worker-client>service worker client</a> started to be
   <a href=https://w3c.github.io/ServiceWorker/#dfn-control id=the-notrestoredreasons-interface:dfn-control data-x-internal=dfn-control>controlled</a> by a <code id=the-notrestoredreasons-interface:serviceworker><a data-x-internal=serviceworker href=https://w3c.github.io/ServiceWorker/#serviceworker>ServiceWorker</a></code> while the page was
   in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsSW>[SW]</a><dt>"<dfn id=sw-claimed data-export=""><code>serviceworker-claimed</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-28><a href=dom.html#document>Document</a></code>'s <a href=https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client id=the-notrestoredreasons-interface:serviceworkercontainer-service-worker-client-2 data-x-internal=serviceworkercontainer-service-worker-client>service worker client</a>'s <a href=webappapis.html#concept-environment-active-service-worker id=the-notrestoredreasons-interface:concept-environment-active-service-worker>active service worker</a> was claimed while
   the page was in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsSW>[SW]</a><dt>"<dfn id=blocking-sw-message data-export=""><code>serviceworker-postmessage</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-29><a href=dom.html#document>Document</a></code>'s <a href=https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client id=the-notrestoredreasons-interface:serviceworkercontainer-service-worker-client-3 data-x-internal=serviceworkercontainer-service-worker-client>service worker client</a>'s <a href=webappapis.html#concept-environment-active-service-worker id=the-notrestoredreasons-interface:concept-environment-active-service-worker-2>active service worker</a> received a
   message while the page was in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsSW>[SW]</a><dt>"<dfn id=blocking-sw-activation data-export=""><code>serviceworker-version-activated</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-30><a href=dom.html#document>Document</a></code>'s <a href=https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client id=the-notrestoredreasons-interface:serviceworkercontainer-service-worker-client-4 data-x-internal=serviceworkercontainer-service-worker-client>service worker client</a>'s <a href=webappapis.html#concept-environment-active-service-worker id=the-notrestoredreasons-interface:concept-environment-active-service-worker-3>active service worker</a>'s version was
   activated while the page was in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>.
   <a href=references.html#refsSW>[SW]</a><dt>"<dfn id=blocking-sw-unregistered data-export=""><code>serviceworker-unregistered</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-31><a href=dom.html#document>Document</a></code>'s <a href=https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client id=the-notrestoredreasons-interface:serviceworkercontainer-service-worker-client-5 data-x-internal=serviceworkercontainer-service-worker-client>service worker client</a>'s <a href=webappapis.html#concept-environment-active-service-worker id=the-notrestoredreasons-interface:concept-environment-active-service-worker-4>active service worker</a>'s <a id=the-notrestoredreasons-interface:service-worker-registration href=https://w3c.github.io/service-workers/#dfn-service-worker-registration data-x-internal=service-worker-registration>service
   worker registration</a> was <a href=https://w3c.github.io/service-workers/#navigator-service-worker-unregister id=the-notrestoredreasons-interface:service-worker-unregister data-x-internal=service-worker-unregister>unregistered</a> while
   the page was in <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsSW>[SW]</a><dt>"<dfn id=blocking-sharedworker data-export=""><code>sharedworker</code></dfn>"<dd>This <code id=the-notrestoredreasons-interface:document-32><a href=dom.html#document>Document</a></code> was in the <a id=the-notrestoredreasons-interface:concept-WorkerGlobalScope-owner-set href=workers.html#concept-WorkerGlobalScope-owner-set>owner set</a> of a
   <code id=the-notrestoredreasons-interface:sharedworkerglobalscope><a href=workers.html#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>.<dt>"<dfn id=blocking-smartcard data-export=""><code>smartcardconnection</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-33><a href=dom.html#document>Document</a></code> had an active <code id=the-notrestoredreasons-interface:smartcardconnection><a data-x-internal=smartcardconnection href=https://wicg.github.io/web-smart-card/#dom-smartcardconnection>SmartCardConnection</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-14>unloading</a>.<dt>"<dfn id=blocking-speech-reco data-export=""><code>speechrecognition</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-34><a href=dom.html#document>Document</a></code> had an active <code id=the-notrestoredreasons-interface:speechrecognition><a data-x-internal=speechrecognition href=https://wicg.github.io/speech-api/#speechrecognition>SpeechRecognition</a></code> while <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-15>unloading</a>.<dt>"<dfn id=blocking-storage data-export=""><code>storageaccess</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-35><a href=dom.html#document>Document</a></code> requested storage access permission by using the Storage Access
   API.<dt>"<dfn id=blocking-unload data-export=""><code>unload-listener</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-36><a href=dom.html#document>Document</a></code> registered an <a id=the-notrestoredreasons-interface:event-listener href=https://dom.spec.whatwg.org/#concept-event-listener data-x-internal=event-listener>event listener</a> for the <code id=the-notrestoredreasons-interface:event-unload><a href=indices.html#event-unload>unload</a></code> event.<dt>"<dfn id=blocking-video-capture data-export=""><code>video-capture</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-37><a href=dom.html#document>Document</a></code> requested video capture permission by using <cite>Media Capture and
   Streams</cite>'s <code id=the-notrestoredreasons-interface:getusermedia()-2><a data-x-internal=getusermedia() href=https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia>getUserMedia()</a></code> with video. <a href=references.html#refsMEDIASTREAM>[MEDIASTREAM]</a><dt>"<dfn id=blocking-webhid data-export=""><code>webhid</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-38><a href=dom.html#document>Document</a></code> called the WebHID API's <code id=the-notrestoredreasons-interface:request-device><a data-x-internal=request-device href=https://wicg.github.io/webhid/#requestdevice-method>requestDevice()</a></code> method.<dt>"<dfn id=blocking-webshare data-export=""><code>webshare</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-39><a href=dom.html#document>Document</a></code> used the Web Share API's <code id=the-notrestoredreasons-interface:dom-navigator-share><a data-x-internal=dom-navigator-share href=https://w3c.github.io/web-share/#share-method>navigator.share()</a></code> method.<dt>"<dfn id=blocking-websocket-used-with-ccns data-export=""><code>websocket-used-with-cache-control-no-store</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-40><a href=dom.html#document>Document</a></code> was created from an HTTP response whose
   `<code id=the-notrestoredreasons-interface:http-cache-control-4><a data-x-internal=http-cache-control href=https://httpwg.org/specs/rfc7234.html#header.cache-control>Cache-Control</a></code>` header included the
   "<code>no-store</code>" token, and it has created a <code id=the-notrestoredreasons-interface:websocket-2-2><a data-x-internal=websocket-2 href=https://websockets.spec.whatwg.org/#websocket>WebSocket</a></code> connection
   which might be used to receive sensitive information, so the page was not in a state that could be
   stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsHTTP>[HTTP]</a> <a href=references.html#refsWEBSOCKETS>[WEBSOCKETS]</a><dt>"<dfn id=blocking-webtransport data-export=""><code>webtransport</code></dfn>"<dd>While <a href=document-lifecycle.html#unload-a-document id=the-notrestoredreasons-interface:unload-a-document-16>unloading</a>, an open <code id=the-notrestoredreasons-interface:webtransport><a data-x-internal=webtransport href=https://w3c.github.io/webtransport/#webtransport>WebTransport</a></code>
   connection was shut down, so the page was not in a state that could be stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsWEBTRANSPORT>[WEBTRANSPORT]</a><dt>"<dfn id=blocking-webtransport-used-with-ccns data-export=""><code>webtransport-used-with-cache-control-no-store</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-41><a href=dom.html#document>Document</a></code> was created from an HTTP response whose
   `<code id=the-notrestoredreasons-interface:http-cache-control-5><a data-x-internal=http-cache-control href=https://httpwg.org/specs/rfc7234.html#header.cache-control>Cache-Control</a></code>` header included the
   "<code>no-store</code>" token, and it has created a <code id=the-notrestoredreasons-interface:webtransport-2><a data-x-internal=webtransport href=https://w3c.github.io/webtransport/#webtransport>WebTransport</a></code> connection
   which might be used to receive sensitive information, so the page was not in a state that could be
   stored in the <a href=browsing-the-web.html#note-bfcache>back/forward cache</a>. <a href=references.html#refsHTTP>[HTTP]</a> <a href=references.html#refsWEBTRANSPORT>[WEBTRANSPORT]</a><dt>"<dfn id=blocking-webxr data-export=""><code>webxrdevice</code></dfn>"<dd>The <code id=the-notrestoredreasons-interface:document-42><a href=dom.html#document>Document</a></code> created a <code id=the-notrestoredreasons-interface:xrsystem><a data-x-internal=xrsystem href=https://immersive-web.github.io/webxr/#xrsystem>XRSystem</a></code>.</dl>

  <hr>

  <p>A <code id=the-notrestoredreasons-interface:notrestoredreasons-4><a href=#notrestoredreasons>NotRestoredReasons</a></code> object has a <dfn id=concept-not-restored-reasons-backing-struct>backing struct</dfn>,
  a <a href=#nrr-struct id=the-notrestoredreasons-interface:nrr-struct>not restored reasons</a> or null, initially null.</p>

  <p>A <code id=the-notrestoredreasons-interface:notrestoredreasons-5><a href=#notrestoredreasons>NotRestoredReasons</a></code> object has a <dfn id=concept-not-restored-reasons-reasons>reasons array</dfn>, a
  <code>FrozenArray&lt;<code id=the-notrestoredreasons-interface:notrestoredreasondetails-5><a href=#notrestoredreasondetails>NotRestoredReasonDetails</a></code>></code> or null,
  initially null.</p>

  <p>A <code id=the-notrestoredreasons-interface:notrestoredreasons-6><a href=#notrestoredreasons>NotRestoredReasons</a></code> object has a <dfn id=concept-not-restored-reasons-children>children array</dfn>, a
  <code>FrozenArray&lt;<a href=#notrestoredreasons id=the-notrestoredreasons-interface:notrestoredreasons-7>NotRestoredReasons</a>></code> or null, initially
  null.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-src data-dfn-type=attribute><code>src</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this-2 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct>backing struct</a>'s <a href=#nrr-src id=the-notrestoredreasons-interface:nrr-src>src</a>.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-id data-dfn-type=attribute><code>id</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this-3 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct-2>backing struct</a>'s <a href=#nrr-id id=the-notrestoredreasons-interface:nrr-id>id</a>.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-name data-dfn-type=attribute><code>name</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this-4 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct-3>backing struct</a>'s <a href=#nrr-name id=the-notrestoredreasons-interface:nrr-name>name</a>.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-url data-dfn-type=attribute><code>url</code></dfn> getter steps are:</p>

  <ol><li><p>If <a id=the-notrestoredreasons-interface:this-5 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct-4>backing struct</a>'s <a href=#nrr-url id=the-notrestoredreasons-interface:nrr-url>URL</a> is null, then return null.<li><p>Return <a id=the-notrestoredreasons-interface:this-6 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct-5>backing struct</a>'s <a href=#nrr-url id=the-notrestoredreasons-interface:nrr-url-2>URL</a>, <a href=https://url.spec.whatwg.org/#concept-url-serializer id=the-notrestoredreasons-interface:concept-url-serializer data-x-internal=concept-url-serializer>serialized</a>.</ol>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-reasons data-dfn-type=attribute><code>reasons</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this-7 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-reasons id=the-notrestoredreasons-interface:concept-not-restored-reasons-reasons>reasons array</a>.</p>

  <p>The <dfn data-dfn-for=NotRestoredReasons id=dom-not-restored-reasons-children data-dfn-type=attribute><code>children</code></dfn> getter steps are to return
  <a id=the-notrestoredreasons-interface:this-8 href=https://webidl.spec.whatwg.org/#this data-x-internal=this>this</a>'s <a href=#concept-not-restored-reasons-children id=the-notrestoredreasons-interface:concept-not-restored-reasons-children>children array</a>.</p>

  <p>To <dfn id=create-a-notrestoredreasons-object data-export="">create a <code>NotRestoredReasons</code> object</dfn> given a <a href=#nrr-struct id=the-notrestoredreasons-interface:nrr-struct-2>not restored reasons</a> <var>backingStruct</var> and a
  <a id=the-notrestoredreasons-interface:realm-2 href=https://tc39.es/ecma262/#sec-code-realms data-x-internal=realm>realm</a> <var>realm</var>:</p>

  <ol><li><p>Let <var>notRestoredReasons</var> be a new <code id=the-notrestoredreasons-interface:notrestoredreasons-8><a href=#notrestoredreasons>NotRestoredReasons</a></code> object created
   in <var>realm</var>.<li><p>Set <var>notRestoredReasons</var>'s <a href=#concept-not-restored-reasons-backing-struct id=the-notrestoredreasons-interface:concept-not-restored-reasons-backing-struct-6>backing struct</a> to
   <var>backingStruct</var>.<li><p>If <var>backingStruct</var>'s <a href=#nrr-reasons id=the-notrestoredreasons-interface:nrr-reasons>reasons</a> is null, set
   <var>notRestoredReasons</var>'s <a href=#concept-not-restored-reasons-reasons id=the-notrestoredreasons-interface:concept-not-restored-reasons-reasons-2>reasons array</a> to null.<li>
    <p>Otherwise:</p>
    <ol><li><p>Let <var>reasonsArray</var> be an empty <a id=the-notrestoredreasons-interface:list href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li>
      <p><a href=https://infra.spec.whatwg.org/#list-iterate id=the-notrestoredreasons-interface:list-iterate data-x-internal=list-iterate>For each</a> <var>reason</var> of
      <var>backingStruct</var>'s <a href=#nrr-reasons id=the-notrestoredreasons-interface:nrr-reasons-2>reasons</a>:</p>
      <ol><li><p><a href=#create-a-notrestoredreasondetails-object id=the-notrestoredreasons-interface:create-a-notrestoredreasondetails-object>Create a <code>NotRestoredReasonDetails</code> object</a> given
       <var>reason</var> and <var>realm</var>, and <a href=https://infra.spec.whatwg.org/#list-append id=the-notrestoredreasons-interface:list-append data-x-internal=list-append>append</a>
       it to <var>reasonsArray</var>.</ol>
     <li><p>Set <var>notRestoredReasons</var>'s <a href=#concept-not-restored-reasons-reasons id=the-notrestoredreasons-interface:concept-not-restored-reasons-reasons-3>reasons array</a> to the result of
     <a id=the-notrestoredreasons-interface:creating-a-frozen-array href=https://webidl.spec.whatwg.org/#dfn-create-frozen-array data-x-internal=creating-a-frozen-array>creating a frozen array</a> given <var>reasonsArray</var>.</ol>
   <li><p>If <var>backingStruct</var>'s <a href=#nrr-children id=the-notrestoredreasons-interface:nrr-children>children</a> is null, set
   <var>notRestoredReasons</var>'s <a href=#concept-not-restored-reasons-children id=the-notrestoredreasons-interface:concept-not-restored-reasons-children-2>children array</a> to null.<li>
    <p>Otherwise:</p>

    <ol><li><p>Let <var>childrenArray</var> be an empty <a id=the-notrestoredreasons-interface:list-2 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a>.<li>
      <p><a href=https://infra.spec.whatwg.org/#list-iterate id=the-notrestoredreasons-interface:list-iterate-2 data-x-internal=list-iterate>For each</a> <var>child</var> of
      <var>backingStruct</var>'s <a href=#nrr-children id=the-notrestoredreasons-interface:nrr-children-2>children</a>:</p>

      <ol><li><p><a href=#create-a-notrestoredreasons-object id=the-notrestoredreasons-interface:create-a-notrestoredreasons-object>Create a <code>NotRestoredReasons</code> object</a> given <var>child</var>
       and <var>realm</var> and <a href=https://infra.spec.whatwg.org/#list-append id=the-notrestoredreasons-interface:list-append-2 data-x-internal=list-append>append</a> it to
       <var>childrenArray</var>.</ol>
     <li><p>Set <var>notRestoredReasons</var>'s <a href=#concept-not-restored-reasons-children id=the-notrestoredreasons-interface:concept-not-restored-reasons-children-3>children array</a> to the result of
     <a id=the-notrestoredreasons-interface:creating-a-frozen-array-2 href=https://webidl.spec.whatwg.org/#dfn-create-frozen-array data-x-internal=creating-a-frozen-array>creating a frozen array</a> given <var>childrenArray</var>.</ol>
   <li><p>Return <var>notRestoredReasons</var>.</ol>

  <p>A <dfn id=nrr-struct data-export="">not restored reasons</dfn> is a <a id=the-notrestoredreasons-interface:struct-2 href=https://infra.spec.whatwg.org/#struct data-x-internal=struct>struct</a> with
  the following <a href=https://infra.spec.whatwg.org/#struct-item id=the-notrestoredreasons-interface:struct-item-2 data-x-internal=struct-item>items</a>:</p>

  <ul><li><p><dfn id=nrr-src>src</dfn>, a <a id=the-notrestoredreasons-interface:scalar-value-string href=https://infra.spec.whatwg.org/#scalar-value-string data-x-internal=scalar-value-string>scalar value string</a> or null, initially
   null.<li><p><dfn id=nrr-id>id</dfn>, a string or null, initially null.<li><p><dfn id=nrr-name>name</dfn>, a string or null, initially null.<li><p><dfn id=nrr-url>url</dfn>, a <a id=the-notrestoredreasons-interface:url href=https://url.spec.whatwg.org/#concept-url data-x-internal=url>URL</a> or null, initially null.<li><p><dfn id=nrr-reasons>reasons</dfn>, null or a <a id=the-notrestoredreasons-interface:list-3 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of
   <a href=#nrr-details-struct id=the-notrestoredreasons-interface:nrr-details-struct-3>not restored reason details</a>, initially null.<li><p><dfn id=nrr-children>children</dfn>, null or a <a id=the-notrestoredreasons-interface:list-4 href=https://infra.spec.whatwg.org/#list data-x-internal=list>list</a> of <a href=#nrr-struct id=the-notrestoredreasons-interface:nrr-struct-3>not restored reasons</a>, initially null.</ul>

  <p>A <dfn data-dfn-for=Document id=concept-document-nrr data-lt="not restored reasons" data-export=""><code>Document</code>'s not restored reasons</dfn> is its <a id=the-notrestoredreasons-interface:node-navigable-4 href=document-sequences.html#node-navigable>node navigable</a>'s
  <a href=document-sequences.html#nav-active-history-entry id=the-notrestoredreasons-interface:nav-active-history-entry>active session history entry</a>'s <a href=browsing-the-web.html#she-document-state id=the-notrestoredreasons-interface:she-document-state>document state</a>'s <a href=browsing-the-web.html#document-state-not-restored-reasons id=the-notrestoredreasons-interface:document-state-not-restored-reasons>not restored reasons</a>, if
  <code id=the-notrestoredreasons-interface:document-43><a href=dom.html#document>Document</a></code>'s <a id=the-notrestoredreasons-interface:node-navigable-5 href=document-sequences.html#node-navigable>node navigable</a> is a <a id=the-notrestoredreasons-interface:top-level-traversable href=document-sequences.html#top-level-traversable>top-level traversable</a>;
  otherwise null.</p>

  <nav><a href=browsers.html>← 7 Loading web pages</a> — <a href=index.html>Table of Contents</a> — <a href=document-sequences.html>7.3 Infrastructure for sequences of documents →</a></nav>
